********************************************************************************
** Communicating doctors' consensus persistently increases Covid-19 vaccinations
** Analysis file
********************************************************************************

*** DEFINE SAMPLE RESTRICTIONS (FOR CMC DATA)
{
program define smpl_restrictions
	{
	keep if medicine==1
	keep if sideeffs_short!=. // keep all those who completed the survey
	drop if district==15 // keep only doctors working in CZ
	keep if doctor // only keep doctors (drop nurses and other medical workers - very few!)
	}
	end
}

*** DEFINE SETS OF CONTROLS
log using "$logpath/02_all_results", replace

*************************************************************************
*************************************************************************
*************************************************************************
** FIGURES **************************************************************
*************************************************************************
*************************************************************************
*************************************************************************
{
*************************************************************************
** Figure 1 *************************************************************
*************************************************************************
* Figure 1.  Doctors' views on Covid-19 vaccines (Supplementary Study, N=9,650).
{
use "$cleandatapath/CLK_vaccines_clean.dta", clear
smpl_restrictions


* TAKEUP
recode vaccine_takeup_vaccinated (100=1) (0=.), gen(vaccine_takeup_vaccinated_g)
recode vaccine_takeup_yes (100=1) (0=.), gen(vaccine_takeup_yes_g)
recode vaccine_takeup_no (100=1) (0=.), gen(vaccine_takeup_no_g)
recode vaccine_takeup_dk (100=1) (0=.), gen(vaccine_takeup_dk_g)

gen category_takeup=1 if vaccine_takeup_vaccinated_g==1 | vaccine_takeup_yes_g==1
replace category_takeup=2 if vaccine_takeup_dk_g==1
replace category_takeup=3 if vaccine_takeup_no_g==1
label define category_takeup 1 "Yes" 2 "Don't know" 3 "No"
label values category_takeup category_takeup

count if vaccine_takeup_vaccinated_g==1
count if vaccine_takeup_yes_g==1
count if vaccine_takeup_dk_g==1
count if vaccine_takeup_no_g==1

graph bar (count) vaccine_takeup_vaccinated_g (count) vaccine_takeup_yes_g (count) vaccine_takeup_dk_g (count) vaccine_takeup_no_g, over(category_takeup) ///
	stack ///
	bar(1, color(navy) fintensity(inten100)) ///
	bar(2, color(navy) fintensity(inten60)) ///
	bar(3, color(gray) fintensity(inten40)) ///
	bar(4, color(maroon) fintensity(inten100)) ///
	title("Panel A: Own vaccination intentions") ///
	ylabel(0 "0%" 965 "10%" 1930 "20%" 2895 "30%" 3860 "40%" 4825 "50%" 5790 "60%" 6755 "70%" 7720 "80%" 8685 "90%" 9650 "100%", ang(h)) ///
	graphregion(color(white)) ysize(4) ///
	legend(off)
*	legend(rows(1) size(small) position(bottom) ///
*	order(1 "I'm already" "vaccinated" 2 "Yes" 3 "Don't know'" 4 "No" )) ///

graph save "$outputpath/Figures/CLK_takeup.gph", replace

* TRUST	
recode vaccine_trust_yes (100=1) (0=.), gen(vaccine_trust_yes_g)
recode vaccine_trust_no (100=1) (0=.), gen(vaccine_trust_no_g)
recode vaccine_trust_dk (100=1) (0=.), gen(vaccine_trust_dk_g)

gen category_trust=1 if vaccine_trust_yes_g==1
replace category_trust=2 if vaccine_trust_dk_g==1
replace category_trust=3 if vaccine_trust_no_g==1
label define category_trust 1 "Yes" 2 "Don't know" 3 "No"
label values category_trust category_trust

count if vaccine_trust_yes_g==1
count if vaccine_trust_dk_g==1
count if vaccine_trust_no_g==1

graph bar (count) vaccine_trust_yes_g (count) vaccine_trust_dk_g (count) vaccine_trust_no_g, over(category_trust) ///
	stack ///
	bar(1, color(navy) fintensity(inten100)) ///
	bar(2, color(gray) fintensity(inten40)) ///
	bar(3, color(maroon) fintensity(inten100)) ///
	title("Panel B: Trust in vaccine") ///
	ylabel(0 "0%" 965 "10%" 1930 "20%" 2895 "30%" 3860 "40%" 4825 "50%" 5790 "60%" 6755 "70%" 7720 "80%" 8685 "90%" 9650 "100%", ang(h)) ///
	graphregion(color(white)) ysize(4) ///
	legend(off)
*	legend(rows(1) size(small) position(bottom) ///
*	order(1 "Yes" 2 "Don't know" 3 "No" )) ///

graph save "$outputpath/Figures/CLK_trust.gph", replace

* RECOMMEND
recode vaccine_recommend_yesact (100=1) (0=.), gen(vaccine_recommend_yesact_g)
recode vaccine_recommend_yespas (100=1) (0=.), gen(vaccine_recommend_yespas_g)
recode vaccine_recommend_nopas (100=1) (0=.), gen(vaccine_recommend_nopas_g)
recode vaccine_recommend_noact (100=1) (0=.), gen(vaccine_recommend_noact_g)
gen vaccine_recommend_dk_g=. // just for consistency across graphs

gen category_recommend=1 if vaccine_recommend_yesact_g==1 | vaccine_recommend_yespas_g==1
replace category_recommend=2 if vaccine_recommend_dk_g==1
replace category_recommend=3 if vaccine_recommend_nopas_g==1 | vaccine_recommend_noact_g==1
label define category_recommend 1 "Yes" 2 "Don't know" 3 "No"
label values category_recommend category_recommend

count if vaccine_recommend_yesact_g ==1
count if vaccine_recommend_yespas_g ==1
count if vaccine_recommend_nopas_g ==1
count if vaccine_recommend_noact_g ==1

graph bar (count) vaccine_recommend_yesact_g (count) vaccine_recommend_yespas_g (count) vaccine_recommend_dk_g (count) vaccine_recommend_nopas_g (count) vaccine_recommend_noact_g, over(category_recommend, gap(*3)) ///
	stack ///
	bar(1, color(navy) fintensity(inten100)) ///
	bar(2, color(navy) fintensity(inten60)) ///
	bar(3, color(gray) fintensity(40)) ///
	bar(4, color(maroon) fintensity(inten60)) ///
	bar(5, color(maroon) fintensity(inten100)) ///
	title("Panel C: Vaccine recommendation to patients") ///
	ylabel(0 "0%" 965 "10%" 1930 "20%" 2895 "30%" 3860 "40%" 4825 "50%" 5790 "60%" 6755 "70%" 7720 "80%" 8685 "90%" 9650 "100%", ang(h)) ///
	graphregion(color(white)) ysize(4) ///
	legend(off)
*	legend(rows(4) size(small) position(bottom) ///
*	order(1 "I will actively recommend vaccinations to them, even without asking for my recommendations" 2 "I will recommend vaccinations if they ask for my recommendations" 3 "I will not recommend vaccinations if they ask for my opinion'" 4 "I will not actively recommend vaccinations, even without asking my opinion" )) ///

graph save "$outputpath/Figures/CLK_recommend.gph", replace
	
* COMBINED
graph combine "$outputpath/Figures/CLK_takeup.gph" "$outputpath/Figures/CLK_trust.gph" "$outputpath/Figures/CLK_recommend.gph", ///
	rows(1) xsize(12)
*	title("Czech medical doctors'" "responses to a question: ...") ///

graph save "$outputpath/Figures/CLK_combined.gph", replace
graph export "$outputpath/Figures/CLK_combined.png", replace
graph export "$outputpath/Figures/CLK_combined.pdf", replace

}

*************************************************************************
** Figure 2 *************************************************************
*************************************************************************
* Figure 2.  Perceptions of doctors' views on Covid-19 vaccines (Main Experiment, N=2,101).
{
use "$cleandatapath/communicating_consensus_clean.dta", clear

*** Panel A: Perceptions of doctors' intentions to get vaccinated
{
sum nQ300_1_1 if vlna==25, d
twoway (histogram nQ300_1_1 if doctor_vaccine_takeup_overest==0 & vlna==25, width(5) color(maroon) freq) ///
	(histogram nQ300_1_1 if doctor_vaccine_takeup_overest==1 & vlna==25, width(5) color(navy)  fintensity(60) freq), ///
	title("Panel A: Perceptions of doctors' intentions to get vaccinated") ///
	xtitle("") ///
	xline(90, lpattern(dash)) ///
	xline(57, lpattern(dash_dot)) ///
	xline(60, lpattern(solid)) ///
	text(250 57 "Mean = 57" 250 60 "Median = 60" 250 90 "True value = 90", orient(vertical) size(small) placement(ne)) ///
	legend(rows(1) size(small) position(bottom) ///
	order(1 "Underestimating" 2 "Overestimating"))

graph save "$outputpath/Figures/histogram_takeup.gph", replace
graph export "$outputpath/Figures/histogram_takeup.png", replace
graph export "$outputpath/Figures/histogram_takeup.pdf", replace

}

*** Panel B: Perceptions of doctors' trust in Covid-19 vaccines
{
sum nQ301_1_1 if vlna==25, d
twoway (histogram nQ301_1_1 if doctor_vaccine_trust_overest==0 & vlna==25, width(5) color(maroon) freq) ///
	(histogram nQ301_1_1 if doctor_vaccine_trust_overest==1 & vlna==25, width(5) color(navy) fintensity(60) freq), ///
	title("Panel B: Perceptions of doctors' trust in Covid-19 vaccines") ///
	xtitle("") ///
	xline(89, lpattern(dash)) ///
	xline(61, lpattern(dash_dot)) ///
	xline(62, lpattern(solid)) ///
	text(250 59 "Mean = 61" 250 62 "Median = 62" 250 89 "True value = 89", orient(vertical) size(small) placement(ne)) ///
	legend(rows(1) size(small) position(bottom) ///
	order(1 "Underestimating" 2 "Overestimating"))

graph save "$outputpath/Figures/histogram_trust.gph", replace
graph export "$outputpath/Figures/histogram_trust.png", replace
graph export "$outputpath/Figures/histogram_trust.pdf", replace

grc1leg "$outputpath/Figures/histogram_takeup.gph" "$outputpath/Figures/histogram_trust.gph", rows(2) ysize(6) legendfrom("$outputpath/Figures/histogram_takeup.gph")
}

graph save "$outputpath/Figures/histogram_combined.gph", replace
graph export "$outputpath/Figures/histogram_combined.png", replace
graph export "$outputpath/Figures/histogram_combined.pdf", replace

}

*************************************************************************
** Figure 3 *************************************************************
*************************************************************************
* Figure 3.  Effects of the CONSENSUS condition on beliefs about doctors' views (Main Experiment).
{
*** BELIEFS ABOUT DOCTORS
{
use "$cleandatapath/communicating_consensus_clean.dta", clear
* Full
xi: reg nQ300_1_1 info_exp $vaccination_controls_pap if vlna==26, r
est store beltakeup26
xi: reg nQ301_1_1 info_exp $vaccination_controls_pap if vlna==26, r
est store beltrust26
dsregress nQ300_1_1 info_exp if vlna==26, controls($vaccination_controls_belief) vce(robust)
est store beltakeup26lasso
dsregress nQ301_1_1 info_exp if vlna==26, controls($vaccination_controls_belief) vce(robust)
est store beltrust26lasso

* Fixed

xi: reg nQ300_1_1 info_exp $vaccination_controls_pap if vlna==26 & allwaves36==1, r
est store belfixtakeup26
xi: reg nQ301_1_1 info_exp $vaccination_controls_pap if vlna==26 & allwaves36==1, r
est store belfixtrust26
dsregress nQ300_1_1 info_exp if vlna==26 & allwaves36==1, controls($vaccination_controls_belief) vce(robust)
est store belfixtakeup26lasso
dsregress nQ301_1_1 info_exp if vlna==26 & allwaves36==1, controls($vaccination_controls_belief) vce(robust)
est store belfixtrust26lasso

count if vlna==26

sum nQ300_1_1 if !info_exp & vlna==26
sum nQ301_1_1 if !info_exp & vlna==26

* Graph
* note("Dates correspond to first day of data collection for each wave")
coefplot ///
	(beltakeup26, offset(-0.40) msymbol(D) label("Full sample, pre-registered controls") color(navy)) ///
	(beltakeup26lasso, offset(-0.15) msymbol(S) label("Full sample, LASSO selected controls") color(navy)) ///
	(belfixtakeup26, offset(0.15) msymbol(T) label("Fixed sample, pre-registered controls") color(maroon)) ///
	(belfixtakeup26lasso, offset(0.40) msymbol(O) label("Fixed sample, LASSO selected controls") color(maroon)), ///
	bylabel("Own vaccination intentions" "{bf:Date:} Mar 29" "{bf:Observations:} 1,940" "{bf:Control mean:} 62.98") yscale(range(0 11)) ylabel(0(2)10, format(%9.2fc)) ///
	|| (beltrust26, offset(-0.40)) (beltrust26lasso, offset(-0.15)) (belfixtrust26, offset(0.15)) (belfixtrust26lasso, offset(0.40)), bylabel("Trust in vaccines" "Mar 29" "1,940" "66.64" ) ///
	|| , keep(info_exp) yline(0, lwidth(vthin) lcolor(gs4)) vertical ///
	byopts(row(1) ///
	subtitle("Panel A: Effect of the CONSENSUS condition on perceptions of doctors'...")) ///
	xscale(lcolor(white)) ///
	coeflabels(info_exp=" ", noticks labsize(medlarge)) ///
	mlabel(" "+string(@b,"%9.2f")+" {it:(p<"+string(@pval+0.001,"%9.3f")+")}") mlabangle(90) mlabgap(1) mlabposition(4) ysize(4) ///
	legend(size(vsmall))
	// note: in this graph all p-values below 0.000; so we can safely add the inequality 
	
graph save "$outputpath/Figures/coefplot_beliefs.gph", replace
graph export "$outputpath/Figures/coefplot_beliefs.png", replace
graph export "$outputpath/Figures/coefplot_beliefs.pdf", replace

* Needs some manual cahnges for adding text and blinding ticks
}

*** VACCINATION INTENTIONS
{
use "$cleandatapath/communicating_consensus_clean.dta", clear

forvalues i=25(1)26 {
	* Full, PAP
	xi: reg vaccinate_intention info_exp $vaccination_controls_pap if vlna==`i', r
	est store vac`i'
	* Full, LASSO
	dsregress vaccinate_intention info_exp if vlna==`i', controls($vaccination_controls_belief) vce(robust)
	est store vaclasso`i'
	* Fixed, PAP
	xi: reg vaccinate_intention info_exp $vaccination_controls_pap if vlna==`i' & allwaves36==1, r
est store vacfix`i'
	* Fixed, LASSO
	dsregress vaccinate_intention info_exp if vlna==`i' & allwaves36==1, controls($vaccination_controls_belief) vce(robust)
	est store vacfixlasso`i'
}

count if vlna==25
count if vlna==26

sum vaccinate_intention if !info_exp & vlna==25
sum vaccinate_intention if !info_exp & vlna==26

* Graph
* note("Dates correspond to first day of data collection for each wave")
coefplot ///
	(vac25, offset(-0.40) msymbol(D) label("Full sample, pre-registered controls") color(navy)) ///
	(vaclasso25, offset(-0.15) msymbol(S) label("Full sample, LASSO selected controls") color(navy)) ///
	(vacfix25, offset(0.15) msymbol(T) label("Fixed sample, pre-registered controls") color(maroon)) ///
	(vacfixlasso25, offset(0.40) msymbol(O) label("Fixed sample, LASSO selected controls") color(maroon)), ///
	bylabel("Mar 15" "2,101" "0.64") yscale(range(-0.05 0.1)) ylabel(-0.05(0.05)0.1, format(%9.2fc)) ///
	|| (vac26, offset(-0.40)) (vaclasso26, offset(-0.15)) (vacfix26, offset(0.15)) (vacfixlasso26, offset(0.40)), bylabel("Mar 29" "1,940" "0.68") ///
	|| , keep(info_exp) yline(0, lwidth(vthin) lcolor(gs4)) vertical ///
	byopts(row(1) ///
	subtitle("Panel B: Effect of the CONSENSUS condition on vaccination intentions")) ///
	xscale(lcolor(white)) ///
	coeflabels(info_exp=" ", noticks labsize(medlarge)) ///
	mlabel(" "+string(@b,"%9.2f")+" {it:(p="+string(@pval,"%9.3f")+")}") mlabangle(90) mlabgap(4) mlabposition(5) ysize(4) ///
	legend(rows(2) size(vsmall))

graph save "$outputpath/Figures/coefplot_vaccination_demand.gph", replace
graph export "$outputpath/Figures/coefplot_vaccination_demand.png", replace
graph export "$outputpath/Figures/coefplot_vaccination_demand.pdf", replace

* Needs some manual changes for adding text and blinding ticks
}

graph combine "$outputpath/Figures/coefplot_beliefs.gph" "$outputpath/Figures/coefplot_vaccination_demand.gph", rows(2) ysize(9)
graph save "$outputpath/Figures/coefplot_beliefs_demand.gph", replace
// need to manually hide legend from Panel A
graph use "$outputpath/Figures/coefplot_beliefs_demand.gph"
graph export "$outputpath/Figures/coefplot_beliefs_demand.png", replace
graph export "$outputpath/Figures/coefplot_beliefs_demand.pdf", replace

}


*************************************************************************
** Figure 4 *************************************************************
*************************************************************************
* Figure 4.  Effects of the CONSENSUS condition on vaccine take-up (Main Experiment). Waves: 26-36
{
use "$cleandatapath/communicating_consensus_clean.dta", clear

forvalues i=26(1)36 {
	* Full, PAP
	xi: reg vaccinated info_exp $vaccination_controls_pap if vlna==`i', r
	est store vac`i'
	* Full, LASSO
	dsregress vaccinated info_exp if vlna==`i', controls($vaccination_controls_belief) vce(robust)
	est store vaclasso`i'
	* Fixed, PAP
	xi: reg vaccinated info_exp $vaccination_controls_pap if vlna==`i' & allwaves36==1, r
est store vacfix`i'
	* Fixed, LASSO
	dsregress vaccinated info_exp if vlna==`i' & allwaves36==1, controls($vaccination_controls_belief) vce(robust)
	est store vacfixlasso`i'
}

count if vlna==26
count if vlna==27
count if vlna==28
count if vlna==29
count if vlna==30
count if vlna==31
count if vlna==32
count if vlna==33
count if vlna==34
count if vlna==35
count if vlna==36 & vlna36_part==1 // note the 50 obfuscation but not main study participants!

sum vaccinated if !info_exp & vlna==26
sum vaccinated if !info_exp & vlna==27
sum vaccinated if !info_exp & vlna==28
sum vaccinated if !info_exp & vlna==29
sum vaccinated if !info_exp & vlna==30
sum vaccinated if !info_exp & vlna==31
sum vaccinated if !info_exp & vlna==32
sum vaccinated if !info_exp & vlna==33
sum vaccinated if !info_exp & vlna==34
sum vaccinated if !info_exp & vlna==35
sum vaccinated if !info_exp & vlna==36 // no need to change anything here, vaccinated dummy not defined for the 50 participants in obfuscation but not main study!

* Graph
* note("Dates correspond to first day of data collection for each wave")
coefplot ///
	(vac26, offset(-0.40) msymbol(D) label("Full sample, pre-registered controls") color(navy)) ///
	(vaclasso26, offset(-0.15) msymbol(S) label("Full sample, LASSO selected controls") color(navy)) ///
	(vacfix26, offset(0.15) msymbol(T) label("Fixed sample, pre-registered controls") color(maroon)) ///
	(vacfixlasso26, offset(0.40) msymbol(O) label("Fixed sample, LASSO selected controls") color(maroon)), ///
	bylabel("Mar 29" "1,940" "0.15") yscale(range(-0.05 0.13)) ylabel(-0.05(0.05)0.1, format(%9.2fc)) ///
	|| (vac27, offset(-0.40)) (vaclasso27, offset(-0.15)) (vacfix27, offset(0.15)) (vacfixlasso27, offset(0.40)), bylabel("Apr 12" "1,939" "0.18") ///
	|| (vac28, offset(-0.40)) (vaclasso28, offset(-0.15)) (vacfix28, offset(0.15)) (vacfixlasso28, offset(0.40)), bylabel("May 3" "1,896" "0.34") ///
	|| (vac29, offset(-0.40)) (vaclasso29, offset(-0.15)) (vacfix29, offset(0.15)) (vacfixlasso29, offset(0.40)), bylabel("May 24" "1,860" "0.54") ///
	|| (vac30, offset(-0.40)) (vaclasso30, offset(-0.15)) (vacfix30, offset(0.15)) (vacfixlasso30, offset(0.40)), bylabel("Jun 21" "1,792" "0.67") ///
	|| (vac31, offset(-0.40)) (vaclasso31, offset(-0.15)) (vacfix31, offset(0.15)) (vacfixlasso31, offset(0.40)), bylabel("Jul 19" "1,620" "0.70") ///
	|| (vac32, offset(-0.40)) (vaclasso32, offset(-0.15)) (vacfix32, offset(0.15)) (vacfixlasso32, offset(0.40)), bylabel("Aug 23" "1,771" "0.73") ///
	|| (vac33, offset(-0.40)) (vaclasso33, offset(-0.15)) (vacfix33, offset(0.15)) (vacfixlasso33, offset(0.40)), bylabel("Sep 27" "1,745" "0.74") ///
	|| (vac34, offset(-0.40)) (vaclasso34, offset(-0.15)) (vacfix34, offset(0.15)) (vacfixlasso34, offset(0.40)), bylabel("Oct 11" "1,734" "0.75") ///
	|| (vac35, offset(-0.40)) (vaclasso35, offset(-0.15)) (vacfix35, offset(0.15)) (vacfixlasso35, offset(0.40)), bylabel("Nov 8" "1,611" "0.75") ///
	|| (vac36, offset(-0.40)) (vaclasso36, offset(-0.15)) (vacfix36, offset(0.15)) (vacfixlasso36, offset(0.40)), bylabel("Nov 29" "1,801" "0.77") ///
	|| , keep(info_exp) yline(0, lwidth(vthin) lcolor(gs4)) vertical ///
	byopts(row(1) ///
	note("Gradual vaccine roll-out", ring(0) pos(-1) size(small) margin(l=13 r=13) box xoffset(-34) yoffset(-8.5)) ///
	caption("Vaccine available for all adults", ring(0) pos(1) size(small) box margin(l=15 r=15) xoffset(-3) yoffset(-8.5)) ///
	) ///
	xscale(lcolor(white)) ///
	coeflabels(info_exp=" ", noticks labsize(medlarge)) ///
	mlabel(" "+string(@b,"%9.2f")+" {it:(p="+string(@pval,"%9.3f")+")}") mlabangle(90) mlabgap(1) mlabposition(3) ysize(4) ///
	legend(rows(2) size(vsmall))
*	mlabel(" "+string(@b,"%9.2f")+" {it:(p="+string(@pval,"%9.3f")+")}") mlabangle(90) mlabgap(1) mlabposition(4) ysize(4) ///

*	title("Effect of information on vaccination rates")) /// -> can be added to byopts

graph save "$outputpath/Figures/coefplot_vaccinated.gph", replace
graph export "$outputpath/Figures/coefplot_vaccinated.png", replace
graph export "$outputpath/Figures/coefplot_vaccinated.pdf", replace

* Needs some manual cahnges for adding text and blinding ticks
}


*************************************************************************
** Figure 5 *************************************************************
*************************************************************************
* Figure 5  Specification chart (different sets of controls)
{
* See example here: https://github.com/hhsievertsen/speccurve/blob/master/spec_curve_demo.do
* See also here: https://www.benjaminbdaniels.com/stata-code/specc/

use "$cleandatapath/communicating_consensus_clean.dta", clear
save "$outputpath/Tables/Specchart/estimates.dta", replace
*clear
cap program drop specchart
program specchart
syntax varlist, [replace] spec(string)
	* save current data
	tempfile temp
	save "`temp'",replace
	*dataset to store estimates
	if "`replace'"!=""{
			clear
			gen beta=.
			gen se=.
			gen spec_id=.
			gen u95=.
			gen u90=.
			gen l95=.
			gen l90=.
			save "$outputpath/Tables/Specchart/estimates.dta",replace
	}	
	else{
		* load dataset
		use "$outputpath/Tables/Specchart/estimates.dta",clear
	}
	* add observation
	local obs=_N+1
	set obs `obs'
	replace spec_id=`obs' if _n==`obs'
	* store estimates
	replace beta =_b[`varlist'] if  spec_id==`obs'
	replace se=_se[`varlist']   if  spec_id==`obs'
	
	replace u95=beta+invt(e(df_r),0.975)*se if  spec_id==`obs'
	replace u90=beta+invt(e(df_r),0.95)*se if  spec_id==`obs'
	replace l95=beta-invt(e(df_r),0.975)*se  if  spec_id==`obs'
	replace l90=beta-invt(e(df_r),0.95)*se  if  spec_id==`obs'
	// approximate by 1.9615/1.6459 for dsregress where df_r not defined - good enough for large numbers
	replace u95=beta+1.9615*se if  spec_id==`obs' & u95==.
	replace u90=beta+1.6459*se if  spec_id==`obs' & u90==.
	replace l95=beta-1.9615*se  if  spec_id==`obs' & l95==.
	replace l90=beta-1.6459*se  if  spec_id==`obs' & l90==.
	
	* store specification
	foreach s in `spec'{
		cap gen `s'=1 			if  spec_id==`obs'
		cap replace `s'=1 		 if  spec_id==`obs'
	}
		save "$outputpath/Tables/Specchart/estimates.dta",replace
	* restore dataset
	use `temp',clear
end

*** FULL SAMPLE SPECIFICATIONS
{
xi: reg vaccinated info_exp i.vlna if vlna>=31 & vlna<=36, vce(cluster respondentId)
specchart info_exp, spec(selfrep ols full) replace

*** SPECIFICATIONS
	xi: reg vaccinated info_exp i.vlna if vlna>=31 & vlna<=36, vce(cluster respondentId)
	specchart info_exp, spec(selfrep ols full) replace
	
	* + Gender + Age
	xi: reg vaccinated info_exp female d_age_cat2 d_age_cat3 d_age_cat4 d_age_cat5 d_age_cat6 i.vlna if vlna>=31 & vlna<=36, vce(cluster respondentId)
	specchart info_exp, spec(gender age selfrep ols full)

	* + Household size + Children
	xi: reg vaccinated info_exp female d_age_cat2 d_age_cat3 d_age_cat4 d_age_cat5 d_age_cat6 hsize children children_missing i.vlna if vlna>=31 & vlna<=36, vce(cluster respondentId)
	specchart info_exp, spec(gender age hhsize children selfrep ols full)

	* + Region + Townsize
	xi: reg vaccinated info_exp female d_age_cat2 d_age_cat3 d_age_cat4 d_age_cat5 d_age_cat6 hsize children children_missing d_region2 d_region3 d_region4 d_region5 d_region6 d_region7 d_region8 d_region9 d_region10 d_region11 d_region12 d_region13 d_region14 d_townsize2 d_townsize3 d_townsize4 d_townsize5 d_townsize6 d_townsize7 i.vlna if vlna>=31 & vlna<=36, vce(cluster respondentId)
	specchart info_exp, spec(gender age hhsize children region townsize selfrep ols full)
	
	* + Education
	xi: reg vaccinated info_exp female d_age_cat2 d_age_cat3 d_age_cat4 d_age_cat5 d_age_cat6 hsize children children_missing d_region2 d_region3 d_region4 d_region5 d_region6 d_region7 d_region8 d_region9 d_region10 d_region11 d_region12 d_region13 d_region14 d_townsize2 d_townsize3 d_townsize4 d_townsize5 d_townsize6 d_townsize7 d_educ2 d_educ3 d_educ4 i.vlna if vlna>=31 & vlna<=36, vce(cluster respondentId)
	specchart info_exp, spec(gender age hhsize children region townsize education selfrep ols full)
		
	* + Economic status + Household income
	xi: reg vaccinated info_exp female d_age_cat2 d_age_cat3 d_age_cat4 d_age_cat5 d_age_cat6 hsize children children_missing d_region2 d_region3 d_region4 d_region5 d_region6 d_region7 d_region8 d_region9 d_region10 d_region11 d_region12 d_region13 d_region14 d_townsize2 d_townsize3 d_townsize4 d_townsize5 d_townsize6 d_townsize7 d_educ2 d_educ3 d_educ4 d_estat2 d_estat3 d_estat4 d_estat5 d_estat6 d_estat7 d_HHincome2 d_HHincome3 d_HHincome4 d_HHincome5 d_HHincome6 d_HHincome7 d_HHincome8 d_HHincome9 d_HHincome10 d_HHincome11 i.vlna if vlna>=31 & vlna<=36, vce(cluster respondentId)
	specchart info_exp, spec(gender age hhsize children region townsize education estat hhincome selfrep ols full)
	
	* + Vaccine prior intentions
	xi: reg vaccinated info_exp female d_age_cat2 d_age_cat3 d_age_cat4 d_age_cat5 d_age_cat6 hsize children children_missing d_region2 d_region3 d_region4 d_region5 d_region6 d_region7 d_region8 d_region9 d_region10 d_region11 d_region12 d_region13 d_region14 d_townsize2 d_townsize3 d_townsize4 d_townsize5 d_townsize6 d_townsize7 d_educ2 d_educ3 d_educ4 d_estat2 d_estat3 d_estat4 d_estat5 d_estat6 d_estat7 d_HHincome2 d_HHincome3 d_HHincome4 d_HHincome5 d_HHincome6 d_HHincome7 d_HHincome8 d_HHincome9 d_HHincome10 d_HHincome11 vaccineyesprior vaccineyesprior_missing i.vlna if vlna>=31 & vlna<=36, vce(cluster respondentId)
	specchart info_exp, spec(gender age hhsize children region townsize education estat hhincome vaccineyesprior main selfrep ols full)
	
	* + Prior beliefs
	xi: reg vaccinated info_exp female d_age_cat2 d_age_cat3 d_age_cat4 d_age_cat5 d_age_cat6 hsize children children_missing d_region2 d_region3 d_region4 d_region5 d_region6 d_region7 d_region8 d_region9 d_region10 d_region11 d_region12 d_region13 d_region14 d_townsize2 d_townsize3 d_townsize4 d_townsize5 d_townsize6 d_townsize7 d_educ2 d_educ3 d_educ4 d_estat2 d_estat3 d_estat4 d_estat5 d_estat6 d_estat7 d_HHincome2 d_HHincome3 d_HHincome4 d_HHincome5 d_HHincome6 d_HHincome7 d_HHincome8 d_HHincome9 d_HHincome10 d_HHincome11 vaccineyesprior vaccineyesprior_missing belief_takeup25 belief_trust25 i.vlna if vlna>=31 & vlna<=36, vce(cluster respondentId)
	specchart info_exp, spec(gender age hhsize children region townsize education estat hhincome vaccineyesprior beliefs selfrep ols full)
	
	* + Prior vaccination status
	xi: reg vaccinated info_exp female d_age_cat2 d_age_cat3 d_age_cat4 d_age_cat5 d_age_cat6 hsize children children_missing d_region2 d_region3 d_region4 d_region5 d_region6 d_region7 d_region8 d_region9 d_region10 d_region11 d_region12 d_region13 d_region14 d_townsize2 d_townsize3 d_townsize4 d_townsize5 d_townsize6 d_townsize7 d_educ2 d_educ3 d_educ4 d_estat2 d_estat3 d_estat4 d_estat5 d_estat6 d_estat7 d_HHincome2 d_HHincome3 d_HHincome4 d_HHincome5 d_HHincome6 d_HHincome7 d_HHincome8 d_HHincome9 d_HHincome10 d_HHincome11 vaccineyesprior vaccineyesprior_missing belief_takeup25 belief_trust25 vaccinated25 i.vlna if vlna>=31 & vlna<=36, vce(cluster respondentId)
	specchart info_exp, spec(gender age hhsize children region townsize education estat hhincome vaccineyesprior beliefs vacstatus selfrep ols full)
	
	* LASSO selected variables
	dsregress vaccinated info_exp if vlna>=31 & vlna<=36, controls($vaccination_controls_belief i.vlna) vce(cluster respondentId)
	qui: estimates store vaccinated
	lassocoef(vaccinated, for(vaccinated))
	specchart info_exp, spec(lasso selfrep full controlsetfull)
}

*** FIXED SAMPLE SPECIFICATIONS
{
	xi: reg vaccinated info_exp i.vlna if vlna>=31 & vlna<=36 & allwaves36==1, vce(cluster respondentId)
	specchart info_exp, spec(selfrep ols fix)
	
	* + Gender + Age
	xi: reg vaccinated info_exp female d_age_cat2 d_age_cat3 d_age_cat4 d_age_cat5 d_age_cat6 i.vlna if vlna>=31 & vlna<=36 & allwaves36==1, vce(cluster respondentId)
	specchart info_exp, spec(gender age selfrep ols fix)
	
	* + Household size + Children
	xi: reg vaccinated info_exp female d_age_cat2 d_age_cat3 d_age_cat4 d_age_cat5 d_age_cat6 hsize children children_missing i.vlna if vlna>=31 & vlna<=36 & allwaves36==1, vce(cluster respondentId)
	specchart info_exp, spec(gender age hhsize children selfrep ols fix)

	* + Region + Townsize
	xi: reg vaccinated info_exp female d_age_cat2 d_age_cat3 d_age_cat4 d_age_cat5 d_age_cat6 hsize children children_missing d_region2 d_region3 d_region4 d_region5 d_region6 d_region7 d_region8 d_region9 d_region10 d_region11 d_region12 d_region13 d_region14 d_townsize2 d_townsize3 d_townsize4 d_townsize5 d_townsize6 d_townsize7 i.vlna if vlna>=31 & vlna<=36 & allwaves36==1, vce(cluster respondentId)
	specchart info_exp, spec(gender age hhsize children region townsize selfrep ols fix)
	
	* + Education
	xi: reg vaccinated info_exp female d_age_cat2 d_age_cat3 d_age_cat4 d_age_cat5 d_age_cat6 hsize children children_missing d_region2 d_region3 d_region4 d_region5 d_region6 d_region7 d_region8 d_region9 d_region10 d_region11 d_region12 d_region13 d_region14 d_townsize2 d_townsize3 d_townsize4 d_townsize5 d_townsize6 d_townsize7 d_educ2 d_educ3 d_educ4 i.vlna if vlna>=31 & vlna<=36 & allwaves36==1, vce(cluster respondentId)
	specchart info_exp, spec(gender age hhsize children region townsize education selfrep ols fix)
		
	* + Economic status + Household income
	xi: reg vaccinated info_exp female d_age_cat2 d_age_cat3 d_age_cat4 d_age_cat5 d_age_cat6 hsize children children_missing d_region2 d_region3 d_region4 d_region5 d_region6 d_region7 d_region8 d_region9 d_region10 d_region11 d_region12 d_region13 d_region14 d_townsize2 d_townsize3 d_townsize4 d_townsize5 d_townsize6 d_townsize7 d_educ2 d_educ3 d_educ4 d_estat2 d_estat3 d_estat4 d_estat5 d_estat6 d_estat7 d_HHincome2 d_HHincome3 d_HHincome4 d_HHincome5 d_HHincome6 d_HHincome7 d_HHincome8 d_HHincome9 d_HHincome10 d_HHincome11 i.vlna if vlna>=31 & vlna<=36 & allwaves36==1, vce(cluster respondentId)
	specchart info_exp, spec(gender age hhsize children region townsize education estat hhincome selfrep ols fix)
	
	* + Vaccine prior
	xi: reg vaccinated info_exp female d_age_cat2 d_age_cat3 d_age_cat4 d_age_cat5 d_age_cat6 hsize children children_missing d_region2 d_region3 d_region4 d_region5 d_region6 d_region7 d_region8 d_region9 d_region10 d_region11 d_region12 d_region13 d_region14 d_townsize2 d_townsize3 d_townsize4 d_townsize5 d_townsize6 d_townsize7 d_educ2 d_educ3 d_educ4 d_estat2 d_estat3 d_estat4 d_estat5 d_estat6 d_estat7 d_HHincome2 d_HHincome3 d_HHincome4 d_HHincome5 d_HHincome6 d_HHincome7 d_HHincome8 d_HHincome9 d_HHincome10 d_HHincome11 vaccineyesprior vaccineyesprior_missing i.vlna if vlna>=31 & vlna<=36 & allwaves36==1, vce(cluster respondentId)
	specchart info_exp, spec(gender age hhsize children region townsize education estat hhincome vaccineyesprior main selfrep ols fix)

	* + Prior beliefs
	xi: reg vaccinated info_exp female d_age_cat2 d_age_cat3 d_age_cat4 d_age_cat5 d_age_cat6 hsize children children_missing d_region2 d_region3 d_region4 d_region5 d_region6 d_region7 d_region8 d_region9 d_region10 d_region11 d_region12 d_region13 d_region14 d_townsize2 d_townsize3 d_townsize4 d_townsize5 d_townsize6 d_townsize7 d_educ2 d_educ3 d_educ4 d_estat2 d_estat3 d_estat4 d_estat5 d_estat6 d_estat7 d_HHincome2 d_HHincome3 d_HHincome4 d_HHincome5 d_HHincome6 d_HHincome7 d_HHincome8 d_HHincome9 d_HHincome10 d_HHincome11 vaccineyesprior vaccineyesprior_missing belief_takeup25 belief_trust25 i.vlna if vlna>=31 & vlna<=36 & allwaves36==1, vce(cluster respondentId)
	specchart info_exp, spec(gender age hhsize children region townsize education estat hhincome vaccineyesprior beliefs selfrep ols fix)
	
	* + Prior vaccination status
	xi: reg vaccinated info_exp female d_age_cat2 d_age_cat3 d_age_cat4 d_age_cat5 d_age_cat6 hsize children children_missing d_region2 d_region3 d_region4 d_region5 d_region6 d_region7 d_region8 d_region9 d_region10 d_region11 d_region12 d_region13 d_region14 d_townsize2 d_townsize3 d_townsize4 d_townsize5 d_townsize6 d_townsize7 d_educ2 d_educ3 d_educ4 d_estat2 d_estat3 d_estat4 d_estat5 d_estat6 d_estat7 d_HHincome2 d_HHincome3 d_HHincome4 d_HHincome5 d_HHincome6 d_HHincome7 d_HHincome8 d_HHincome9 d_HHincome10 d_HHincome11 vaccineyesprior vaccineyesprior_missing belief_takeup25 belief_trust25 vaccinated25 i.vlna if vlna>=31 & vlna<=36 & allwaves36==1, vce(cluster respondentId)
	specchart info_exp, spec(gender age hhsize children region townsize education estat hhincome vaccineyesprior beliefs vacstatus selfrep ols fix)
	
	* LASSO selected variables
	dsregress vaccinated info_exp if vlna>=31 & vlna<=36 & allwaves36==1, controls($vaccination_controls_belief i.vlna) vce(cluster respondentId)
	specchart info_exp, spec(lasso selfrep fix controlsetfix)
}

*** CREATE FIGURE 5: SPECIFICATIONS
{
use "$outputpath/Tables/Specchart/estimates.dta",clear
keep if selfrep!=.
* drop duplicates 
duplicates drop gender age hhsize children region townsize education estat hhincome vaccineyesprior beliefs vacstatus lasso full fix controlsetfull controlsetfix, force
/* sort specification by category */
gsort -gender -age -hhsize -children -region -townsize -education -estat -hhincome -vaccineyesprior -beliefs -vacstatus ///
	-ols -lasso ///
	-selfrep ///
	-full -fix ///
	-controlsetfull -controlsetfix, mfirst
/* sort estimates by coefificent size, uncomment to activate sort by category */
sort spec_id
* rank
gen rank=_n
* gen indicators and scatters
	local scoff=" "
	local scon=" "
	local ind=-0.015
	
foreach var in gender age hhsize children region townsize education estat hhincome vaccineyesprior beliefs vacstatus {
	   cap gen i_`var'=`ind'
	   local ind=`ind'-0.004
	   local scoff="`scoff' (scatter i_`var' rank,msize(vsmall) mcolor(gs10) msymbol(D))" 
	   local scon="`scon' (scatter i_`var' rank if `var'==1,msize(vsmall) mcolor(black) msymbol(D))" 
	}

	local ind=`ind'-0.013 // change this when adding more controls (gap between controls and waves)
foreach var in main lasso {
	   cap gen i_`var'=`ind'
	   local ind=`ind'-0.004
	   local scoff="`scoff' (scatter i_`var' rank,msize(vsmall) mcolor(gs10) msymbol(D))" 
	   local scon="`scon' (scatter i_`var' rank if `var'==1,msize(vsmall) mcolor(black) msymbol(D))" 
	}
	
	local ind=`ind'-0.013 // change this when adding more controls (gap between controls and waves)
foreach var in full fix {
	   cap gen sample_`var'=`ind'
	   local ind=`ind'-0.004
	   local scoff="`scoff' (scatter sample_`var' rank, msize(vsmall) mcolor(gs10) msymbol(D))" 
	   local scon="`scon' (scatter sample_`var' rank if `var'==1,msize(vsmall) mcolor(black) msymbol(D))" 
	}

* plot
twoway (scatter beta rank if main==1, mcolor(black) msymbol(D)  msize(small)) ///  main spec 
   (rbar u95 l95 rank, fcolor(gs12) lcolor(gs12) lwidth(none)) /// 95% CI
   (rbar u90 l90 rank, fcolor(gs10) lcolor(gs16) lwidth(none)) /// 90% CI
   (rbar u95 l95 rank if fix==1, fcolor(bluishgray) lcolor(gs12) lwidth(none)) /// 95% CI for fixed sample
   (rbar u90 l90 rank if fix==1, fcolor(ebg) lcolor(gs16) lwidth(none)) /// 90% CI for fixed sample
   (scatter beta rank, mcolor(black) msymbol(D) msize(small)) ///  point estimates
   `scoff' `scon' /// indicators for spec
   (scatter beta rank if main==1 | controlsetfix==1 | controlsetfull==1, mcolor(blue) msymbol(D)  msize(small)) ///  main spec 
   (scatter i_gender rank if main==1,msize(vsmall) msymbol(D) mcolor(blue))  ///
   (scatter i_age rank if main==1,msize(vsmall) msymbol(D) mcolor(blue))  ///
   (scatter i_hhsize rank if main==1,msize(vsmall) msymbol(D) mcolor(blue))  ///
   (scatter i_children rank if main==1,msize(vsmall) msymbol(D) mcolor(blue))  ///
   (scatter i_region rank if main==1,msize(vsmall) msymbol(D) mcolor(blue))  ///
   (scatter i_townsize rank if main==1,msize(vsmall) msymbol(D) mcolor(blue))  ///
   (scatter i_education rank if main==1,msize(vsmall) msymbol(D) mcolor(blue))  ///
   (scatter i_estat rank if main==1,msize(vsmall) msymbol(D) mcolor(blue))  ///
   (scatter i_hhincome rank if main==1,msize(vsmall) msymbol(D) mcolor(blue))  ///
   (scatter i_vaccineyesprior rank if main==1,msize(vsmall) msymbol(D) mcolor(blue))  ///
   (scatter i_age rank if controlsetfull==1,msize(vsmall) msymbol(D) mcolor(blue))  ///
   (scatter i_vaccineyesprior rank if controlsetfix==1 | controlsetfull==1,msize(vsmall) msymbol(D) mcolor(blue))  ///
   (scatter i_beliefs rank if controlsetfix==1 | controlsetfull==1,msize(vsmall) msymbol(D) mcolor(blue))  ///
   (scatter i_vacstatus rank if controlsetfix==1 | controlsetfull==1,msize(vsmall) msymbol(D) mcolor(blue))  ///
   ,legend (order(6 "Effect of the CONSENSUS condition" 2 "95% CI" 3 "90% CI") region(lcolor(white)) ///
	pos(12) ring(1) rows(1) size(vsmall) symysize(small) symxsize(small)) ///
   xtitle(" ") ytitle(" ") ///
    xscale(noline) ylab(0(0.01)0.08, noticks nogrid angle(horizontal) labsize(vsmall)) xlab("", noticks)  ///
   graphregion (fcolor(white) lcolor(white)) plotregion(fcolor(white) lcolor(white)) ///
   yline(0)
   
* now add stuff to the y axis  
local ind=-0.01
gr_edit .yaxis1.add_ticks `ind' `"{bf:Controls}             "', custom tickset(major) editstyle(tickstyle(textstyle(size(vsmall))) )
local ind=`ind'-0.004
gr_edit .yaxis1.add_ticks `ind' `"Gender"', custom tickset(major) editstyle(tickstyle(textstyle(size(vsmall))) )
local ind=`ind'-0.004
gr_edit .yaxis1.add_ticks `ind' `"Age"', custom tickset(major) editstyle(tickstyle(textstyle(size(vsmall))) )
local ind=`ind'-0.004
gr_edit .yaxis1.add_ticks `ind' `"Household size"', custom tickset(major) editstyle(tickstyle(textstyle(size(vsmall))) )
local ind=`ind'-0.004
gr_edit .yaxis1.add_ticks `ind' `"Children"', custom tickset(major) editstyle(tickstyle(textstyle(size(vsmall))) )
local ind=`ind'-0.004
gr_edit .yaxis1.add_ticks `ind' `"Region"', custom tickset(major) editstyle(tickstyle(textstyle(size(vsmall))) )
local ind=`ind'-0.004
gr_edit .yaxis1.add_ticks `ind' `"Town size"', custom tickset(major) editstyle(tickstyle(textstyle(size(vsmall))) )
local ind=`ind'-0.004
gr_edit .yaxis1.add_ticks `ind' `"Education"', custom tickset(major) editstyle(tickstyle(textstyle(size(vsmall))) )
local ind=`ind'-0.004
gr_edit .yaxis1.add_ticks `ind' `"Economic status"', custom tickset(major) editstyle(tickstyle(textstyle(size(vsmall))) )
local ind=`ind'-0.004
gr_edit .yaxis1.add_ticks `ind' `"Household income"', custom tickset(major) editstyle(tickstyle(textstyle(size(vsmall))) )
local ind=`ind'-0.004
gr_edit .yaxis1.add_ticks `ind' `"Prior vaccination intentions"', custom tickset(major) editstyle(tickstyle(textstyle(size(vsmall))) )
local ind=`ind'-0.004
gr_edit .yaxis1.add_ticks `ind' `"Prior beliefs about medical doctors"', custom tickset(major) editstyle(tickstyle(textstyle(size(vsmall))) )
local ind=`ind'-0.004
gr_edit .yaxis1.add_ticks `ind' `"Prior vaccination status"', custom tickset(major) editstyle(tickstyle(textstyle(size(vsmall))) )

local ind=`ind'-0.013
gr_edit .yaxis1.add_ticks `ind' `"{bf:Specification}                     "', custom tickset(major) editstyle(tickstyle(textstyle(size(vsmall))) )
local ind=`ind'-0.004
gr_edit .yaxis1.add_ticks `ind' `"Pre-registered variables controls"', custom tickset(major) editstyle(tickstyle(textstyle(size(vsmall))) )
local ind=`ind'-0.004
gr_edit .yaxis1.add_ticks `ind' `"LASSO selected controls"', custom tickset(major) editstyle(tickstyle(textstyle(size(vsmall))) )

local ind=`ind'-0.013
gr_edit .yaxis1.add_ticks `ind' `"{bf:Sample}                     "', custom tickset(major) editstyle(tickstyle(textstyle(size(vsmall))) )
local ind=`ind'-0.004
gr_edit .yaxis1.add_ticks `ind' `"Full"', custom tickset(major) editstyle(tickstyle(textstyle(size(vsmall))) )
local ind=`ind'-0.004
gr_edit .yaxis1.add_ticks `ind' `"Fixed"', custom tickset(major) editstyle(tickstyle(textstyle(size(vsmall))) )

gr_edit .yaxis1.add_ticks 0.09 `"Coefficient"', custom tickset(major) editstyle(tickstyle(textstyle(size(small))) )


graph save "$outputpath/Figures/specchart_fixed.gph", replace
graph export "$outputpath/Figures/specchart_fixed.png", replace
graph export "$outputpath/Figures/specchart_fixed.pdf", replace

}
}




*************************************************************************
** Extended Data Fig. 1 ************************************************************
*************************************************************************
* Extended Data Fig. 1. Comparison of development of vaccination rate in the CONTROL group and the Czech adult population.
{
use "$cleandatapath/communicating_consensus_clean.dta", clear
* Generate population vaccination data
* Data obtained from https://ockovani.opendatalab.cz/statistiky
* Always for a Tuesday in the week of data collection (that starts Mondays)
* We use number of individuals vaccinated with at least one dose
gen vaccinated_pop=0.100502 if vlna==25
replace vaccinated_pop=0.137181 if vlna==26
replace vaccinated_pop=0.169460 if vlna==27
replace vaccinated_pop=0.271687 if vlna==28
replace vaccinated_pop=0.410048 if vlna==29
replace vaccinated_pop=0.561944 if vlna==30
replace vaccinated_pop=0.628927 if vlna==31
replace vaccinated_pop=0.679787 if vlna==32
replace vaccinated_pop=0.701186 if vlna==33
replace vaccinated_pop=0.705815 if vlna==34
replace vaccinated_pop=0.734160 if vlna==35
replace vaccinated_pop=0.767910 if vlna==36
* Adult population 18+: 8,717,518 (note that numbers of vaccines partially confounded by vaccinations for kids below 18 from September on)

* Generate weighted vaccination sample data
generate vaccinated_aw=.
forvalues i= 25/36 {
  qui sum vaccinated if info_exp==0 & vlna==`i' [aw=vahy]
  replace vaccinated_aw = r(mean) if vlna==`i'
  }

collapse (mean) vaccinated_pop (mean) vaccinated_aw, by(vlna)
graph twoway ///
	(connected vaccinated_pop vlna if vlna>=25, msymbol(D) mcolor(navy) mlabel(vaccinated_pop) mlabformat(%9.2f) mlabposition(12) mlabgap(3)) ///
	(connected vaccinated_aw vlna if vlna>=25, msymbol(T) mcolor(maroon) mlabel(vaccinated_aw) mlabformat(%9.2f) mlabposition(6) mlabgap(3)), ///
	yscale(range(0 0.7)) ylabel(0(0.1)0.7) ///
	xlabel(25 "Mar 15" 26 "Mar 29" 27 "Apr 12" 28 "May 3" 29 "May 24" 30 "Jun 21" 31 "Jul 19" 32 "Aug 23" 33 "Sep 27" 34 "Oct 11" 35 "Nov 11" 36 "Nov 29", angle(45)) ///
	xtitle("") ///
	legend(rows(2) size(small) position(bottom) ///
	order(1 "Population vaccination rate" 2 "Weighted sample vaccination rates (CONTROL)"))

graph save "$outputpath/Figures/vaccinated_population.gph", replace
graph export "$outputpath/Figures/vaccinated_population.png", replace
graph export "$outputpath/Figures/vaccinated_population.pdf", replace

}

*************************************************************************
** Extended Data Fig. 2 *************************************************************
*************************************************************************
* Extended Data Fig. 2  Effects of the CONSENSUS condition on second dose take-up and on intentions to take-up a third (booster) dose (Main Experiment). Waves: 31-36
{
use "$cleandatapath/communicating_consensus_clean.dta", clear
*** Second dose take-up
	xi: reg vaccinated_dose2 info_exp $vaccination_controls_pap i.vlna if vlna>=31 & vlna<=36, vce(cluster respondentId)
	est store vac2
	* Full, LASSO
	xi: dsregress vaccinated_dose2 info_exp if vlna>=31 & vlna<=36, controls($vaccination_controls_belief i.vlna) vce(cluster respondentId)
	est store vaclasso2
	* Fixed, PAP
	xi: reg vaccinated_dose2 info_exp $vaccination_controls_pap i.vlna if vlna>=31 & vlna<=36 & allwaves36==1, vce(cluster respondentId)
est store vacfix2
	* Fixed, LASSO
	xi: dsregress vaccinated_dose2 info_exp if vlna>=31 & vlna<=36 & allwaves36==1, controls($vaccination_controls_belief i.vlna) vce(cluster respondentId)
	est store vacfixlasso2

*** Third dose intentions
	xi: reg vaccinate_intention_dose3 info_exp $vaccination_controls_pap i.vlna if vlna==33 | vlna==35 | vlna==36, vce(cluster respondentId)
	est store vac3
	* Full, LASSO
	xi: dsregress vaccinate_intention_dose3 info_exp if vlna==33 | vlna==35 | vlna==36, controls($vaccination_controls_belief i.vlna) vce(cluster respondentId)
	est store vaclasso3
	* Fixed, PAP
	xi: reg vaccinate_intention_dose3 info_exp $vaccination_controls_pap i.vlna if (vlna==33 | vlna==35 | vlna==36) & allwaves36==1, vce(cluster respondentId)
est store vacfix3
	* Fixed, LASSO
	xi: dsregress vaccinate_intention_dose3 info_exp if (vlna==33 | vlna==35 | vlna==36) & allwaves36==1, controls($vaccination_controls_belief i.vlna) vce(cluster respondentId)
	est store vacfixlasso3
	
sum vaccinated_dose2 if !info_exp & vlna>=31 & vlna<=36
sum vaccinate_intention_dose3 if !info_exp & vlna==33 | vlna==35 | vlna==36

* Graph
* note("Dates correspond to first day of data collection for each wave")
coefplot ///
	(vac2, offset(-0.40) msymbol(D) label("Full sample, pre-registered controls") color(navy)) ///
	(vaclasso2, offset(-0.15) msymbol(S) label("Full sample, LASSO selected controls") color(navy)) ///
	(vacfix2, offset(0.15) msymbol(T) label("Fixed sample, pre-registered controls") color(maroon)) ///
	(vacfixlasso2, offset(0.40) msymbol(O) label("Fixed sample, LASSO selected controls") color(maroon)), ///
	bylabel("{bf:Dependent variable:} Second dose take-up" "{bf:Data collection:} Waves 6 - 11" "{bf:Control mean:} 0.70") yscale(range(-0.05 0.1)) ylabel(-0.05(0.05)0.1, format(%9.2fc)) ///
	|| (vac3, offset(-0.40)) (vaclasso3, offset(-0.15)) (vacfix3, offset(0.15)) (vacfixlasso3, offset(0.40)), bylabel("Third dose intentions" "Waves 8, 10, 11" "0.62") ///
	|| , keep(info_exp) yline(0, lwidth(vthin) lcolor(gs4)) vertical ///
	byopts(row(1)) ///
	xscale(lcolor(white)) ///
	coeflabels(info_exp=" ", noticks labsize(medlarge)) ///
	mlabel(" "+string(@b,"%9.2f")+" {it:(p="+string(@pval,"%9.3f")+")}") mlabangle(90) mlabgap(1) mlabposition(3) ysize(4) ///
	legend(rows(2) size(vsmall))
*	mlabel(" "+string(@b,"%9.2f")+" {it:(p="+string(@pval,"%9.3f")+")}") mlabangle(90) mlabgap(1) mlabposition(4) ysize(4) ///

*	title("Effect of information on vaccination rates")) /// -> can be added to byopts

graph save "$outputpath/Figures/coefplot_vaccinated_dose_2_3.gph", replace
graph export "$outputpath/Figures/coefplot_vaccinated_dose_2_3.png", replace
graph export "$outputpath/Figures/coefplot_vaccinated_dose_2_3.pdf", replace

* Needs some manual cahnges for adding text and blinding ticks
}

*************************************************************************
** Extended Data Fig. 3 ************************************************************
*************************************************************************
* Extended Data Fig. 3. Weekly average of newly confirmed Covid-19 cases per 100,000 population.
{
*** DATA FOR CASE NUMBERS BY DATE, TOTAL POPULATION
clear
* data downloaded from: https://onemocneni-aktualne.mzcr.cz/api/v2/covid-19/osoby.csv
* Official data from the Czech Ministry of Health
import delimited "$rawdatapath/220112_infections_CZ_individual_MZCR.csv", encoding(UTF-8)


gen date = date(datum, "YMD")
format date %td

drop pohlavi kraj_nuts_kod okres_lau_kod nakaza_v_zahranici nakaza_zeme_csu_kod 
gen case_number=1

collapse (count) case_number, by(date)
* calculate daily cases per 100,000 inhabitants
* see how population size obtained below
gen case_number_100000=(case_number*100000)/10701777

tsset  date, daily

* generate weekly moving averages
generate case_number_100000_wk = (F3.case_number_100000 + F2.case_number_100000 + F1.case_number_100000 + case_number_100000 + L1.case_number_100000 + L2.case_number_100000 + L3.case_number_100000) / 7

* Wave position (0 to 7)
di daily("20210315","YMD")
di daily("20210329","YMD")
di daily("20210412","YMD")
di daily("20210503","YMD")
di daily("20210524","YMD")
di daily("20210621","YMD")
di daily("20210719","YMD")
di daily("20210823","YMD")
di daily("20210927","YMD")
di daily("20211011","YMD")
di daily("20211108","YMD")
di daily("20211129","YMD")


graph twoway line case_number_100000_wk date, ///
	ytitle("Weekly average of newly confirmed" "Covid-19 cases per 100,000 population") ///
	yscale(range(0 180)) ylabel(0(20)180) ///
	xlabel(, angle(45)) xtitle("") ///
	xline(22354, lpattern(dash)) ///
	xline(22368, lpattern(dash)) ///
	xline(22382, lpattern(dash)) ///
	xline(22403, lpattern(dash)) ///
	xline(22424, lpattern(dash)) ///
	xline(22452, lpattern(dash)) ///
	xline(22480, lpattern(dash)) ///
	xline(22515, lpattern(dash)) ///
	xline(22550, lpattern(dash)) ///
	xline(22564, lpattern(dash)) ///
	xline(22592, lpattern(dash)) ///
	xline(22613, lpattern(dash)) ///
	text(100 22354 "Wave0" 100 22368 "Wave1" 100 22382 "Wave2" 100 22403 "Wave3" 100 22424 "Wave4" 100 22452 "Wave5" 100 22480 "Wave6" 100 22515 "Wave7" 100 22550 "Wave8" 100 22564 "Wave9" 100 22592 "Wave10" 100 22613 "Wave11", orient(vertical) size(small) placement(ne)) ///
	tlabel(01apr2020 01may2020 01jun2020 01jul2020 01aug2020 01sep2020 01oct2020 01nov2020 01dec2020 01jan2021 01feb2021 01mar2021 01apr2021 01may2021 01jun2021 01jul2021 01aug2021 01sep2021 01oct2021 01nov2021 01dec2021, format(%tdMon_dd,_CCYY))
graph save "$outputpath/Figures/covid_cases.gph", replace
graph export "$outputpath/Figures/covid_cases.png", replace
graph export "$outputpath/Figures/covid_cases.pdf", replace

*** DATA FOR POPULATION BY THE END OF 2020
preserve
clear
import delimited "$rawdatapath/210928_population_structure_CZSO.csv", encoding(UTF-8)
* data downloaded on Sep 28, 2021 from: https://www.czso.cz/csu/czso/obyvatelstvo-podle-petiletych-vekovych-skupin-a-pohlavi-v-krajich-a-okresech
* Official data from the Czech Statistical Office

* restrict sample such that it represents total population of CZ by the end of 2020
drop if vek_txt=="" // drop data with no age structure
drop if pohlavi_txt=="" // keep only data by gender
keep if vuzemi_cis==97 //only keep data for CZ, drop region specific data
keep if casref_do=="2020-12-31" // keep data for 2020 only

sum hodnota
display r(sum)
* Gives total population of CZ: 10701777
restore
}

*************************************************************************
** Figure A1 ************************************************************
*************************************************************************
* Supplementary Figure A1. Perceptions of opinions of doctors about the Covid-19 vaccines, excluding inattentive participants (Main Experiment). 
{
use "$cleandatapath/communicating_consensus_clean.dta", clear
*** Dropping inattentive
preserve
keep if attentive

*** Panel A: Perceptions of doctors' intentions to get vaccinated
{
sum nQ300_1_1 if vlna==25, d
twoway (histogram nQ300_1_1 if doctor_vaccine_takeup_overest==0 & vlna==25, width(5) color(maroon) freq) ///
	(histogram nQ300_1_1 if doctor_vaccine_takeup_overest==1 & vlna==25, width(5) color(navy)  fintensity(60) freq), ///
	title("Panel A: Own vaccination intentions" "(Attentive)") ///
	xtitle("") ///
	xline(90, lpattern(dash)) ///
	xline(57, lpattern(dash_dot)) ///
	xline(60, lpattern(solid)) ///
	text(180 52 "Mean = 57" 180 60 "Median = 60" 160 90 "True value = 90", orient(vertical) size(small) placement(ne)) ///
	legend(rows(1) size(small) position(bottom) ///
	order(1 "Underestimating" 2 "Overestimating"))

graph save "$outputpath/Figures/histogram_takeup_attentive.gph", replace
graph export "$outputpath/Figures/histogram_takeup_attentive.png", replace
}

*** Panel B: Perceptions of doctors' trust in Covid-19 vaccines
{
sum nQ301_1_1 if vlna==25, d
twoway (histogram nQ301_1_1 if doctor_vaccine_trust_overest==0 & vlna==25, width(5) color(maroon) freq) ///
	(histogram nQ301_1_1 if doctor_vaccine_trust_overest==1 & vlna==25, width(5) color(navy) fintensity(60) freq), ///
	title("Panel B: Trust in vaccine" "(Attentive)") ///
	xtitle("") ///
	xline(89, lpattern(dash)) ///
	xline(61, lpattern(dash_dot)) ///
	xline(62, lpattern(solid)) ///
	text(180 57 "Mean = 62" 180 63 "Median = 63" 160 89 "True value = 89", orient(vertical) size(small) placement(ne)) ///
	legend(rows(1) size(small) position(bottom) ///
	order(1 "Underestimating" 2 "Overestimating"))

graph save "$outputpath/Figures/histogram_trust_attentive.gph", replace
graph export "$outputpath/Figures/histogram_trust_attentive.png", replace
}
restore

*** Dropping bottom 10% response times
preserve
keep if filling_time_minuty>=10.23333 
* This is dropping bottom 10% response times in wave 25: sum filling_time_minuty if vlna==25, d

*** Panel C: Perceptions of doctors' intentions to get vaccinated
{
sum nQ300_1_1 if vlna==25, d
twoway (histogram nQ300_1_1 if doctor_vaccine_takeup_overest==0 & vlna==25, width(5) color(maroon) freq) ///
	(histogram nQ300_1_1 if doctor_vaccine_takeup_overest==1 & vlna==25, width(5) color(navy)  fintensity(60) freq), ///
	title("Panel C: Own vaccination intentions" "(Response time)") ///
	xtitle("") ///
	xline(90, lpattern(dash)) ///
	xline(57, lpattern(dash_dot)) ///
	xline(60, lpattern(solid)) ///
	text(180 53 "Mean = 57" 180 60 "Median = 60" 160 90 "True value = 90", orient(vertical) size(small) placement(ne)) ///
	legend(rows(1) size(small) position(bottom) ///
	order(1 "Underestimating" 2 "Overestimating"))

graph save "$outputpath/Figures/histogram_takeup_duration.gph", replace
graph export "$outputpath/Figures/histogram_takeup_duration.png", replace
}

*** Panel D: Perceptions of doctors' trust in Covid-19 vaccines
{
sum nQ301_1_1 if vlna==25, d
twoway (histogram nQ301_1_1 if doctor_vaccine_trust_overest==0 & vlna==25, width(5) color(maroon) freq) ///
	(histogram nQ301_1_1 if doctor_vaccine_trust_overest==1 & vlna==25, width(5) color(navy) fintensity(60) freq), ///
	title("Panel D: Trust in vaccine" "(Response time)") ///
	xtitle("") ///
	xline(89, lpattern(dash)) ///
	xline(61, lpattern(dash_dot)) ///
	xline(62, lpattern(solid)) ///
	text(180 56 "Mean = 62" 180 64 "Median = 64" 160 89 "True value = 89", orient(vertical) size(small) placement(ne)) ///
	legend(rows(1) size(small) position(bottom) ///
	order(1 "Underestimating" 2 "Overestimating"))

graph save "$outputpath/Figures/histogram_trust_duration.gph", replace
graph export "$outputpath/Figures/histogram_trust_duration.png", replace
}
restore


grc1leg "$outputpath/Figures/histogram_takeup_attentive.gph" "$outputpath/Figures/histogram_trust_attentive.gph" "$outputpath/Figures/histogram_takeup_duration.gph" "$outputpath/Figures/histogram_trust_duration.gph", rows(2) ysize(6) legendfrom("$outputpath/Figures/histogram_takeup_attentive.gph") title("Perceptions of doctors'...")

graph save "$outputpath/Figures/histogram_combined_attentive.gph", replace
graph export "$outputpath/Figures/histogram_combined_attentive.png", replace


}


*************************************************************************
** Figure A2 ************************************************************
*************************************************************************
* Supplementary Figure 2. Timeline of the numbers of people waiting for their first and second doses.
{
clear
import delimited "$rawdatapath/220114_vaccine_wait_time_MZCR.csv", encoding(UTF-8)

gen date = date(datum, "YMDhms")
format date %td

tsset date, daily

graph twoway (line rezervace_cekajici_1 date) (line rezervace_cekajici_2 date) (line rezervace_cekajici_3 date), ///
	legend(rows(1) size(small) position(bottom) order(1 "Waiting for the first dose" 2 "Waiting for the second dose")) ///
	ytitle("Number of individuals") ///
	yscale(range(0 1600000)) ylabel(0(200000)1600000) ///
	xlabel(, angle(45)) xtitle("") ///
	xline(22354, lpattern(dash)) ///
	xline(22368, lpattern(dash)) ///
	xline(22382, lpattern(dash)) ///
	xline(22403, lpattern(dash)) ///
	xline(22424, lpattern(dash)) ///
	xline(22452, lpattern(dash)) ///
	xline(22480, lpattern(dash)) ///
	xline(22515, lpattern(dash)) ///
	xline(22550, lpattern(dash)) ///
	xline(22564, lpattern(dash)) ///
	xline(22592, lpattern(dash)) ///
	xline(22613, lpattern(dash)) ///
	text(100 22354 "Wave0" 100 22368 "Wave1" 100 22382 "Wave2" 100 22403 "Wave3" 100 22424 "Wave4" 100 22452 "Wave5" 100 22480 "Wave6" 100 22515 "Wave7" 100 22550 "Wave8" 100 22564 "Wave9" 100 22592 "Wave10" 100 22613 "Wave11", orient(vertical) size(small) placement(ne)) ///
	tlabel(01mar2021 01apr2021 01may2021 01jun2021 01jul2021 01aug2021 01sep2021 01oct2021 01nov2021 01dec2021, format(%tdMon_dd,_CCYY))
	
graph save "$outputpath/Figures/vaccine_queue.gph", replace
graph export "$outputpath/Figures/vaccine_queue.png", replace
}

*************************************************************************
** Figure A3 ************************************************************
*************************************************************************
* Supplementary Figure 3. Cumulative fraction of adult (18+) EU/EEA and Czech population receiving at least one dose of Covid-19 vaccines by reporting week.
{
clear
import delimited "$rawdatapath/220112_vaccine_EU.csv", encoding(UTF-8)

* Generate weekly data
* Following: https://journals.sagepub.com/doi/pdf/10.1177/1536867X1201200316
generate year = real(substr(yearweek, 1, 4))
generate week = real(substr(yearweek, -2, 2))
generate jan1 = dow(mdy(1,1,year))
local wanted = 5
generate weekdates = cond(jan1 <= `wanted', 1 -  jan1 + `wanted', 8 - jan1 + `wanted')
replace weekdates = weekdates +  7 * (week - 1)
replace weekdates = . if weekdates > doy(mdy(12, 31, year))

generate date = mdy(1,1,year) + weekdates - 1
format date %td
drop jan1

* Keep data for all adults 18+
* keep if targetgroup=="ALL" // ALL was 18+ before, not anymore
keep if targetgroup=="Age18_24" | targetgroup=="Age25_49" | targetgroup=="Age50_59" | targetgroup=="Age60_69" | targetgroup=="Age70_79" | targetgroup=="Age80+"
* Keep national level data
keep if region==reportingcountry

* All vaccines together, first doses only
collapse (sum) firstdose (mean) population (mean) denominator, by(reportingcountry date targetgroup)
collapse (sum) firstdose (mean) population (sum) denominator, by(reportingcountry date)

gen firstdose_frac=firstdose/denominator


* Generate EU adult population variable
bysort date: egen eu_pop_t=sum(denominator)
egen eu_pop=max(eu_pop_t) // I calculate with the highest number reported for either of the weeks
drop eu_pop_t
* Generate EU first dose vaccination number and fraction of adult population vaccinated in a given week
bysort date: egen eu_firstdose=sum(firstdose)
gen eu_firstdose_frac=eu_firstdose/eu_pop

* Set a panel structure
xtset date

sort reportingcountry date
bysort reportingcountry: gen firstdose_frac_cum= sum(firstdose_frac) // cumulative fraction of adult population with at least one dose by country by week
gen eu_firstdose_frac_cum= sum(eu_firstdose_frac) if reportingcountry=="CZ"  // cumulative fraction of adult EU population with at least one dose by week
*replace eu_firstdose_frac_cum=eu_firstdose_frac_cum/2

graph twoway (line eu_firstdose_frac_cum date) (line firstdose_frac_cum date) if reportingcountry=="CZ", ///
	legend(rows(1) size(small) position(bottom) order(1 "EU/EEA" 2 "CZ")) ///
	yscale(range(0 0.8)) ylabel(0(0.1)0.8) ///
	xlabel(, angle(45)) xtitle("") ///
	xline(22354, lpattern(dash)) ///
	xline(22368, lpattern(dash)) ///
	xline(22382, lpattern(dash)) ///
	xline(22403, lpattern(dash)) ///
	xline(22424, lpattern(dash)) ///
	xline(22452, lpattern(dash)) ///
	xline(22480, lpattern(dash)) ///
	xline(22515, lpattern(dash)) ///
	xline(22550, lpattern(dash)) ///
	xline(22564, lpattern(dash)) ///
	xline(22592, lpattern(dash)) ///
	xline(22613, lpattern(dash)) ///
	text(0.5 22354 "Wave0" 0.5 22368 "Wave1" 0.5 22382 "Wave2" 0.5 22403 "Wave3" 0.5 22424 "Wave4" 0.5 22452 "Wave5" 0.5 22480 "Wave6" 0.5 22515 "Wave7" 0.5 22550 "Wave8" 0.5 22564 "Wave9" 0.5 22592 "Wave10" 0.5 22613 "Wave11", orient(vertical) size(small) placement(ne)) ///
	tlabel(01jan2021 01feb2021 01mar2021 01apr2021 01may2021 01jun2021 01jul2021 01aug2021 01sep2021 01oct2021 01nov2021 01dec2021, format(%tdMon_dd,_CCYY))
graph save "$outputpath/Figures/vaccination_cz_eea.gph", replace
graph export "$outputpath/Figures/vaccination_cz_eea.png", replace
}
}


*************************************************************************
*************************************************************************
*************************************************************************
** TABLES ***************************************************************
*************************************************************************
*************************************************************************
*************************************************************************
{

*************************************************************************
** Extended Data Table 1 *************************************************************
*************************************************************************
* Extended Data Table 1. Demographic characteristics: summary statistics and randomization check, full sample (Main Experiment).
{
use "$cleandatapath/communicating_consensus_clean.dta", clear
* Overall
sum female d_age_cat1 d_age_cat2 d_age_cat3 d_age_cat4 d_age_cat5 d_age_cat6 hsize children children_missing d_region1 d_region2 d_region3 d_region4 d_region5 d_region6 d_region7 d_region8 d_region9 d_region10 d_region11 d_region12 d_region13 d_region14 d_townsize1 d_townsize2 d_townsize3 d_townsize4 d_townsize5 d_townsize6 d_townsize7 d_educ1 d_educ2 d_educ3 d_educ4 d_estat1 d_estat2 d_estat3 d_estat4 d_estat5 d_estat6 d_estat7 d_HHincome1 d_HHincome2 d_HHincome3 d_HHincome4 d_HHincome5 d_HHincome6 d_HHincome7 d_HHincome8 d_HHincome9 d_HHincome10 d_HHincome11  vaccineyesprior vaccineyesprior_missing vaccinated25 nQ300_1_1 nQ301_1_1 if vlna==25 

* Comparison of CONTROL and CONSENSUS groups
orth_out female d_age_cat1 d_age_cat2 d_age_cat3 d_age_cat4 d_age_cat5 d_age_cat6 hsize children children_missing d_region1 d_region2 d_region3 d_region4 d_region5 d_region6 d_region7 d_region8 d_region9 d_region10 d_region11 d_region12 d_region13 d_region14 d_townsize1 d_townsize2 d_townsize3 d_townsize4 d_townsize5 d_townsize6 d_townsize7 d_educ1 d_educ2 d_educ3 d_educ4 d_estat1 d_estat2 d_estat3 d_estat4 d_estat5 d_estat6 d_estat7 d_HHincome1 d_HHincome2 d_HHincome3 d_HHincome4 d_HHincome5 d_HHincome6 d_HHincome7 d_HHincome8 d_HHincome9 d_HHincome10 d_HHincome11  vaccineyesprior vaccineyesprior_missing vaccinated25 nQ300_1_1 nQ301_1_1 if vlna==25, by(info_exp) overall pcompare

* Chi2 test for binary variables
foreach x in female d_age_cat1 d_age_cat2 d_age_cat3 d_age_cat4 d_age_cat5 d_age_cat6 children_missing d_region1 d_region2 d_region3 d_region4 d_region5 d_region6 d_region7 d_region8 d_region9 d_region10 d_region11 d_region12 d_region13 d_region14 d_townsize1 d_townsize2 d_townsize3 d_townsize4 d_townsize5 d_townsize6 d_townsize7 d_educ1 d_educ2 d_educ3 d_educ4 d_estat1 d_estat2 d_estat3 d_estat4 d_estat5 d_estat6 d_estat7 d_HHincome1 d_HHincome2 d_HHincome3 d_HHincome4 d_HHincome5 d_HHincome6 d_HHincome7 d_HHincome8 d_HHincome9 d_HHincome10 d_HHincome11  vaccineyesprior vaccineyesprior_missing vaccinated25 {
	di "`x'"
	tab `x' info_exp  if vlna==25, chi2
}

* Ranksum test for continuous variables
foreach x in hsize children nQ300_1_1 nQ301_1_1 {
	di "`x'"
	ranksum `x'  if vlna==25, by(info_exp)
}

count if vlna==25 & !info_exp
count if vlna==25 & info_exp

*** Omnibus randomization test
reg info_exp $vaccination_controls_belief if vlna==25
/*
F(52, 2048)     =      1.07
Prob > F        =    0.3416
*/
}

*************************************************************************
** Extended Data Table 2 *************************************************************
*************************************************************************
* Extended Data Table 2. Timeline of the experiment.
* Only in paper
{
*Number of observations per wave
use "$cleandatapath/communicating_consensus_clean_revision.dta", clear

tab vaccinated info_exp if vlna==24
tab vaccinated info_exp if vlna==25
tab vaccinated info_exp if vlna==26
tab vaccinated info_exp if vlna==27
tab vaccinated info_exp if vlna==28
tab vaccinated info_exp if vlna==29
tab vaccinated info_exp if vlna==30
tab vaccinated info_exp if vlna==31
tab vaccinated info_exp if vlna==32
tab vaccinated info_exp if vlna==33
tab vaccinated info_exp if vlna==34
tab vaccinated info_exp if vlna==35
tab vaccinated info_exp if vlna==36
}
*************************************************************************
** Extended Data Table 3 *************************************************************
*************************************************************************
* Extended Data Table 3. Effect of the CONSENSUS condition on respondents' vaccination take-up (Main Experiment).
{
use "$cleandatapath/communicating_consensus_clean.dta", clear

local append replace
forvalues i=26(1)36 {
	* Full, PAP
	xi: reg vaccinated info_exp $vaccination_controls_pap if vlna==`i', r
	outreg2 using "$outputpath/Tables/regs_vaccinated.xls" , `append' dec(3) se keep(info_exp)
	local append append
}

forvalues i=26(1)36 {
	* Full, LASSO
	dsregress vaccinated info_exp if vlna==`i', controls($vaccination_controls_belief) vce(robust)
	outreg2
}
forvalues i=26(1)36 {
	* Fixed, PAP
	xi: reg vaccinated info_exp $vaccination_controls_pap if vlna==`i' & allwaves36==1, r
	outreg2
}
forvalues i=26(1)36 {
	* Fixed, LASSO
	dsregress vaccinated info_exp if vlna==`i' & allwaves36==1, controls($vaccination_controls_belief) vce(robust)
	outreg2
}

sum vaccinated if !info_exp & vlna==26
sum vaccinated if !info_exp & vlna==27
sum vaccinated if !info_exp & vlna==28
sum vaccinated if !info_exp & vlna==29
sum vaccinated if !info_exp & vlna==30
sum vaccinated if !info_exp & vlna==31
sum vaccinated if !info_exp & vlna==32
sum vaccinated if !info_exp & vlna==33
sum vaccinated if !info_exp & vlna==34
sum vaccinated if !info_exp & vlna==35
sum vaccinated if !info_exp & vlna==36

sum vaccinated if !info_exp & vlna==26 & allwaves36==1
sum vaccinated if !info_exp & vlna==27 & allwaves36==1
sum vaccinated if !info_exp & vlna==28 & allwaves36==1
sum vaccinated if !info_exp & vlna==29 & allwaves36==1
sum vaccinated if !info_exp & vlna==30 & allwaves36==1
sum vaccinated if !info_exp & vlna==31 & allwaves36==1
sum vaccinated if !info_exp & vlna==32 & allwaves36==1
sum vaccinated if !info_exp & vlna==33 & allwaves36==1
sum vaccinated if !info_exp & vlna==34 & allwaves36==1
sum vaccinated if !info_exp & vlna==35 & allwaves36==1
sum vaccinated if !info_exp & vlna==36 & allwaves36==1

* Randomization inference, Full
ritest info_exp _b[info_exp], reps(10) seed(840801): reg vaccinated info_exp $vaccination_controls_pap if vlna==26, r
ritest info_exp _b[info_exp], reps(10) seed(840801): reg vaccinated info_exp $vaccination_controls_pap if vlna==27, r
ritest info_exp _b[info_exp], reps(10) seed(840801): reg vaccinated info_exp $vaccination_controls_pap if vlna==28, r
ritest info_exp _b[info_exp], reps(10) seed(840801): reg vaccinated info_exp $vaccination_controls_pap if vlna==29, r
ritest info_exp _b[info_exp], reps(10) seed(840801): reg vaccinated info_exp $vaccination_controls_pap if vlna==30, r
ritest info_exp _b[info_exp], reps(10) seed(840801): reg vaccinated info_exp $vaccination_controls_pap if vlna==31, r
ritest info_exp _b[info_exp], reps(10) seed(840801): reg vaccinated info_exp $vaccination_controls_pap if vlna==32, r
ritest info_exp _b[info_exp], reps(10) seed(840801): reg vaccinated info_exp $vaccination_controls_pap if vlna==33, r
ritest info_exp _b[info_exp], reps(10) seed(840801): reg vaccinated info_exp $vaccination_controls_pap if vlna==34, r
ritest info_exp _b[info_exp], reps(10) seed(840801): reg vaccinated info_exp $vaccination_controls_pap if vlna==35, r
ritest info_exp _b[info_exp], reps(10) seed(840801): reg vaccinated info_exp $vaccination_controls_pap if vlna==36, r

* Randomization inference, Fixed
ritest info_exp _b[info_exp], reps(10) seed(840801): reg vaccinated info_exp $vaccination_controls_pap if vlna==26 & allwaves36==1, r
ritest info_exp _b[info_exp], reps(10) seed(840801): reg vaccinated info_exp $vaccination_controls_pap if vlna==27 & allwaves36==1, r
ritest info_exp _b[info_exp], reps(10) seed(840801): reg vaccinated info_exp $vaccination_controls_pap if vlna==28 & allwaves36==1, r
ritest info_exp _b[info_exp], reps(10) seed(840801): reg vaccinated info_exp $vaccination_controls_pap if vlna==29 & allwaves36==1, r
ritest info_exp _b[info_exp], reps(10) seed(840801): reg vaccinated info_exp $vaccination_controls_pap if vlna==30 & allwaves36==1, r
ritest info_exp _b[info_exp], reps(10) seed(840801): reg vaccinated info_exp $vaccination_controls_pap if vlna==31 & allwaves36==1, r
ritest info_exp _b[info_exp], reps(10) seed(840801): reg vaccinated info_exp $vaccination_controls_pap if vlna==32 & allwaves36==1, r
ritest info_exp _b[info_exp], reps(10) seed(840801): reg vaccinated info_exp $vaccination_controls_pap if vlna==33 & allwaves36==1, r
ritest info_exp _b[info_exp], reps(10) seed(840801): reg vaccinated info_exp $vaccination_controls_pap if vlna==34 & allwaves36==1, r
ritest info_exp _b[info_exp], reps(10) seed(840801): reg vaccinated info_exp $vaccination_controls_pap if vlna==35 & allwaves36==1, r
ritest info_exp _b[info_exp], reps(10) seed(840801): reg vaccinated info_exp $vaccination_controls_pap if vlna==36 & allwaves36==1, r

}


*************************************************************************
** Extended Data Table 4 *************************************************************
*************************************************************************
* Extended Data Table 4. Effect of the CONSENSUS condition on respondents' vaccination take-up: specifications (Main Experiment).
{
use "$cleandatapath/communicating_consensus_clean.dta", clear

*** Full sample
* No controls
xi: reg vaccinated info_exp i.vlna if vlna>=31 & vlna<=36, vce(cluster respondentId)
outreg2 outreg2 using "$outputpath/Tables/regs_vaccinated2.xls" , replace dec(3) se keep(info_exp)

* + Gender + Age
xi: reg vaccinated info_exp female d_age_cat2 d_age_cat3 d_age_cat4 d_age_cat5 d_age_cat6 i.vlna if vlna>=31 & vlna<=36, vce(cluster respondentId)
outreg2

* + Household size + Children
xi: reg vaccinated info_exp female d_age_cat2 d_age_cat3 d_age_cat4 d_age_cat5 d_age_cat6 hsize children children_missing i.vlna if vlna>=31 & vlna<=36, vce(cluster respondentId)
outreg2

* + Region + Townsize
xi: reg vaccinated info_exp female d_age_cat2 d_age_cat3 d_age_cat4 d_age_cat5 d_age_cat6 hsize children children_missing d_region2 d_region3 d_region4 d_region5 d_region6 d_region7 d_region8 d_region9 d_region10 d_region11 d_region12 d_region13 d_region14 d_townsize2 d_townsize3 d_townsize4 d_townsize5 d_townsize6 d_townsize7 i.vlna if vlna>=31 & vlna<=36, vce(cluster respondentId)
outreg2

* + Education
xi: reg vaccinated info_exp female d_age_cat2 d_age_cat3 d_age_cat4 d_age_cat5 d_age_cat6 hsize children children_missing d_region2 d_region3 d_region4 d_region5 d_region6 d_region7 d_region8 d_region9 d_region10 d_region11 d_region12 d_region13 d_region14 d_townsize2 d_townsize3 d_townsize4 d_townsize5 d_townsize6 d_townsize7 d_educ2 d_educ3 d_educ4 i.vlna if vlna>=31 & vlna<=36, vce(cluster respondentId)
outreg2

* + Economic status + Household income
xi: reg vaccinated info_exp female d_age_cat2 d_age_cat3 d_age_cat4 d_age_cat5 d_age_cat6 hsize children children_missing d_region2 d_region3 d_region4 d_region5 d_region6 d_region7 d_region8 d_region9 d_region10 d_region11 d_region12 d_region13 d_region14 d_townsize2 d_townsize3 d_townsize4 d_townsize5 d_townsize6 d_townsize7 d_educ2 d_educ3 d_educ4 d_estat2 d_estat3 d_estat4 d_estat5 d_estat6 d_estat7 d_HHincome2 d_HHincome3 d_HHincome4 d_HHincome5 d_HHincome6 d_HHincome7 d_HHincome8 d_HHincome9 d_HHincome10 d_HHincome11 i.vlna if vlna>=31 & vlna<=36, vce(cluster respondentId)
outreg2

* + Vaccine prior
xi: reg vaccinated info_exp female d_age_cat2 d_age_cat3 d_age_cat4 d_age_cat5 d_age_cat6 hsize children children_missing d_region2 d_region3 d_region4 d_region5 d_region6 d_region7 d_region8 d_region9 d_region10 d_region11 d_region12 d_region13 d_region14 d_townsize2 d_townsize3 d_townsize4 d_townsize5 d_townsize6 d_townsize7 d_educ2 d_educ3 d_educ4 d_estat2 d_estat3 d_estat4 d_estat5 d_estat6 d_estat7 d_HHincome2 d_HHincome3 d_HHincome4 d_HHincome5 d_HHincome6 d_HHincome7 d_HHincome8 d_HHincome9 d_HHincome10 d_HHincome11 vaccineyesprior vaccineyesprior_missing i.vlna if vlna>=31 & vlna<=36, vce(cluster respondentId)
outreg2

* + Prior beliefs
xi: reg vaccinated info_exp female d_age_cat2 d_age_cat3 d_age_cat4 d_age_cat5 d_age_cat6 hsize children children_missing d_region2 d_region3 d_region4 d_region5 d_region6 d_region7 d_region8 d_region9 d_region10 d_region11 d_region12 d_region13 d_region14 d_townsize2 d_townsize3 d_townsize4 d_townsize5 d_townsize6 d_townsize7 d_educ2 d_educ3 d_educ4 d_estat2 d_estat3 d_estat4 d_estat5 d_estat6 d_estat7 d_HHincome2 d_HHincome3 d_HHincome4 d_HHincome5 d_HHincome6 d_HHincome7 d_HHincome8 d_HHincome9 d_HHincome10 d_HHincome11 vaccineyesprior vaccineyesprior_missing belief_takeup25 belief_trust25 i.vlna if vlna>=31 & vlna<=36, vce(cluster respondentId)
outreg2

* + Prior vaccination status
xi: reg vaccinated info_exp female d_age_cat2 d_age_cat3 d_age_cat4 d_age_cat5 d_age_cat6 hsize children children_missing d_region2 d_region3 d_region4 d_region5 d_region6 d_region7 d_region8 d_region9 d_region10 d_region11 d_region12 d_region13 d_region14 d_townsize2 d_townsize3 d_townsize4 d_townsize5 d_townsize6 d_townsize7 d_educ2 d_educ3 d_educ4 d_estat2 d_estat3 d_estat4 d_estat5 d_estat6 d_estat7 d_HHincome2 d_HHincome3 d_HHincome4 d_HHincome5 d_HHincome6 d_HHincome7 d_HHincome8 d_HHincome9 d_HHincome10 d_HHincome11 vaccineyesprior vaccineyesprior_missing belief_takeup25 belief_trust25 vaccinated25 i.vlna if vlna>=31 & vlna<=36, vce(cluster respondentId)
outreg2

* LASSO selected variables
dsregress vaccinated info_exp if vlna>=31 & vlna<=36, controls($vaccination_controls_belief i.vlna) vce(cluster respondentId)
outreg2

*** Fixed sample
* No controls
xi: reg vaccinated info_exp i.vlna if vlna>=31 & vlna<=36 & allwaves36==1, vce(cluster respondentId)
outreg2

* + Gender + Age
xi: reg vaccinated info_exp female d_age_cat2 d_age_cat3 d_age_cat4 d_age_cat5 d_age_cat6 i.vlna if vlna>=31 & vlna<=36 & allwaves36==1, vce(cluster respondentId)
outreg2

* + Household size + Children
xi: reg vaccinated info_exp female d_age_cat2 d_age_cat3 d_age_cat4 d_age_cat5 d_age_cat6 hsize children children_missing i.vlna if vlna>=31 & vlna<=36 & allwaves36==1, vce(cluster respondentId)
outreg2

* + Region + Townsize
xi: reg vaccinated info_exp female d_age_cat2 d_age_cat3 d_age_cat4 d_age_cat5 d_age_cat6 hsize children children_missing d_region2 d_region3 d_region4 d_region5 d_region6 d_region7 d_region8 d_region9 d_region10 d_region11 d_region12 d_region13 d_region14 d_townsize2 d_townsize3 d_townsize4 d_townsize5 d_townsize6 d_townsize7 i.vlna if vlna>=31 & vlna<=36 & allwaves36==1, vce(cluster respondentId)
outreg2

* + Education
xi: reg vaccinated info_exp female d_age_cat2 d_age_cat3 d_age_cat4 d_age_cat5 d_age_cat6 hsize children children_missing d_region2 d_region3 d_region4 d_region5 d_region6 d_region7 d_region8 d_region9 d_region10 d_region11 d_region12 d_region13 d_region14 d_townsize2 d_townsize3 d_townsize4 d_townsize5 d_townsize6 d_townsize7 d_educ2 d_educ3 d_educ4 i.vlna if vlna>=31 & vlna<=36 & allwaves36==1, vce(cluster respondentId)
outreg2

* + Economic status + Household income
xi: reg vaccinated info_exp female d_age_cat2 d_age_cat3 d_age_cat4 d_age_cat5 d_age_cat6 hsize children children_missing d_region2 d_region3 d_region4 d_region5 d_region6 d_region7 d_region8 d_region9 d_region10 d_region11 d_region12 d_region13 d_region14 d_townsize2 d_townsize3 d_townsize4 d_townsize5 d_townsize6 d_townsize7 d_educ2 d_educ3 d_educ4 d_estat2 d_estat3 d_estat4 d_estat5 d_estat6 d_estat7 d_HHincome2 d_HHincome3 d_HHincome4 d_HHincome5 d_HHincome6 d_HHincome7 d_HHincome8 d_HHincome9 d_HHincome10 d_HHincome11 i.vlna if vlna>=31 & vlna<=36 & allwaves36==1, vce(cluster respondentId)
outreg2

* + Vaccine prior
xi: reg vaccinated info_exp female d_age_cat2 d_age_cat3 d_age_cat4 d_age_cat5 d_age_cat6 hsize children children_missing d_region2 d_region3 d_region4 d_region5 d_region6 d_region7 d_region8 d_region9 d_region10 d_region11 d_region12 d_region13 d_region14 d_townsize2 d_townsize3 d_townsize4 d_townsize5 d_townsize6 d_townsize7 d_educ2 d_educ3 d_educ4 d_estat2 d_estat3 d_estat4 d_estat5 d_estat6 d_estat7 d_HHincome2 d_HHincome3 d_HHincome4 d_HHincome5 d_HHincome6 d_HHincome7 d_HHincome8 d_HHincome9 d_HHincome10 d_HHincome11 vaccineyesprior vaccineyesprior_missing i.vlna if vlna>=31 & vlna<=36 & allwaves36==1, vce(cluster respondentId)
outreg2

* + Prior beliefs
xi: reg vaccinated info_exp female d_age_cat2 d_age_cat3 d_age_cat4 d_age_cat5 d_age_cat6 hsize children children_missing d_region2 d_region3 d_region4 d_region5 d_region6 d_region7 d_region8 d_region9 d_region10 d_region11 d_region12 d_region13 d_region14 d_townsize2 d_townsize3 d_townsize4 d_townsize5 d_townsize6 d_townsize7 d_educ2 d_educ3 d_educ4 d_estat2 d_estat3 d_estat4 d_estat5 d_estat6 d_estat7 d_HHincome2 d_HHincome3 d_HHincome4 d_HHincome5 d_HHincome6 d_HHincome7 d_HHincome8 d_HHincome9 d_HHincome10 d_HHincome11 vaccineyesprior vaccineyesprior_missing belief_takeup25 belief_trust25 i.vlna if vlna>=31 & vlna<=36 & allwaves36==1, vce(cluster respondentId)
outreg2

* + Prior vaccination status
xi: reg vaccinated info_exp female d_age_cat2 d_age_cat3 d_age_cat4 d_age_cat5 d_age_cat6 hsize children children_missing d_region2 d_region3 d_region4 d_region5 d_region6 d_region7 d_region8 d_region9 d_region10 d_region11 d_region12 d_region13 d_region14 d_townsize2 d_townsize3 d_townsize4 d_townsize5 d_townsize6 d_townsize7 d_educ2 d_educ3 d_educ4 d_estat2 d_estat3 d_estat4 d_estat5 d_estat6 d_estat7 d_HHincome2 d_HHincome3 d_HHincome4 d_HHincome5 d_HHincome6 d_HHincome7 d_HHincome8 d_HHincome9 d_HHincome10 d_HHincome11 vaccineyesprior vaccineyesprior_missing belief_takeup25 belief_trust25 vaccinated25 i.vlna if vlna>=31 & vlna<=36 & allwaves36==1, vce(cluster respondentId)
outreg2

* LASSO selected variables
dsregress vaccinated info_exp if vlna>=31 & vlna<=36 & allwaves36==1, controls($vaccination_controls_belief i.vlna) vce(cluster respondentId)
outreg2

sum vaccinated if !info_exp & vlna>=31 & vlna<=36
sum vaccinated if !info_exp & vlna>=31 & vlna<=36 & allwaves36==1
}

*************************************************************************
** Extended Data Table 5 *************************************************************
*************************************************************************
* Extended Data Table 5. Effect of the CONSENSUS condition on respondents' vaccination take-up: additional results (Main Experiment).
{
use "$cleandatapath/communicating_consensus_clean.dta", clear
* Panel A: Waves 31-36
reg vaccinated info_exp $vaccination_controls_pap i.vlna if vlna>=31 & vlna<=36, vce(cluster respondentId)
outreg2 using "$outputpath/Tables/regs_vaccinated_heterog.xls" , replace dec(3) se keep(info_exp)
reg vaccinated info_exp $vaccination_controls_pap i.vlna if vlna>=31 & vlna<=36 & allwaves36==1, vce(cluster respondentId)
outreg2

* IMPUTED DATA
* a) If subsequent wave data missing, duplicate from current wave (and mark as extrapolated from previous wave)
gen extrapolated=0
forval i=25(1)35{
	local j=`i'+1
	expand 2 if vlna==`i' & vlna`j'_part==0, gen(wave_duplicate)
	replace vlna=`j' if wave_duplicate==1
	replace extrapolated=1 if wave_duplicate==1
	drop wave_duplicate
}
xi: reg vaccinated info_exp $vaccination_controls_pap i.vlna extrapolated if vlna>=31 & vlna<=36, vce(cluster respondentId)
outreg2
sum vaccinated if vlna>=31 & vlna<=36 & info_exp==0
drop if extrapolated==1 // now restore to the original dataset
drop extrapolated
* b) If previous wave data missing, duplicate from current wave (and mark as extrapolated from next wave)
gen extrapolated=0
forval i=36(-1)25{
	local j=`i'-1
	expand 2 if vlna==`i' & vlna`j'_part==0, gen(wave_duplicate)
	replace vlna=`j' if wave_duplicate==1
	replace extrapolated=1 if wave_duplicate==1
	drop wave_duplicate
}
xi: reg vaccinated info_exp $vaccination_controls_pap i.vlna extrapolated if vlna>=31 & vlna<=36, vce(cluster respondentId)
outreg2
sum vaccinated if vlna>=31 & vlna<=36 & info_exp==0
drop if extrapolated==1 // now restore to the original dataset
drop extrapolated

reg vaccinated info_exp $vaccination_controls_pap i.vlna if vlna>=31 & vlna<=36 & attentive==1, vce(cluster respondentId)
outreg2
reg vaccinated info_exp $vaccination_controls_pap i.vlna if vlna>=31 & vlna<=36 & doctor_vaccine_trust_overest==0, vce(cluster respondentId)
outreg2
reg vaccinated info_exp $vaccination_controls_pap i.vlna if vlna>=31 & vlna<=36 & doctor_vaccine_trust_overest==1, vce(cluster respondentId)
outreg2
reg vaccinated info_exp $vaccination_controls_pap i.vlna if vlna>=31 & vlna<=36 & doctor_vaccine_takeup_overest==0, vce(cluster respondentId)
outreg2
reg vaccinated info_exp $vaccination_controls_pap i.vlna if vlna>=31 & vlna<=36 & doctor_vaccine_takeup_overest==1, vce(cluster respondentId)
outreg2
reg vaccinated info_exp $vaccination_controls_pap i.vlna if vlna>=31 & vlna<=36 & vaccineyesprior==0, vce(cluster respondentId)
outreg2
reg vaccinated info_exp $vaccination_controls_pap i.vlna if vlna>=31 & vlna<=36 & vaccineyesprior==1, vce(cluster respondentId)
outreg2


*** Randomization inference
ritest info_exp _b[info_exp], reps(10) seed(840801) cluster(respondentId): reg vaccinated info_exp $vaccination_controls_pap i.vlna if vlna>=31 & vlna<=36, vce(cluster respondentId)
ritest info_exp _b[info_exp], reps(10) seed(840801) cluster(respondentId): reg vaccinated info_exp $vaccination_controls_pap i.vlna if vlna>=31 & vlna<=36 & allwaves36==1, vce(cluster respondentId)

* IMPUTED DATA
* a) If subsequent wave data missing, duplicate from current wave (and mark as extrapolated from previous wave)
gen extrapolated=0
forval i=25(1)35{
	local j=`i'+1
	expand 2 if vlna==`i' & vlna`j'_part==0, gen(wave_duplicate)
	replace vlna=`j' if wave_duplicate==1
	replace extrapolated=1 if wave_duplicate==1
	drop wave_duplicate
}
ritest info_exp _b[info_exp], reps(10) seed(840801) cluster(respondentId):  reg vaccinated info_exp $vaccination_controls_pap i.vlna extrapolated if vlna>=31 & vlna<=36, vce(cluster respondentId)
drop if extrapolated==1 // now restore to the original dataset
drop extrapolated
* b) If previous wave data missing, duplicate from current wave (and mark as extrapolated from next wave)
gen extrapolated=0
forval i=36(-1)25{
	local j=`i'-1
	expand 2 if vlna==`i' & vlna`j'_part==0, gen(wave_duplicate)
	replace vlna=`j' if wave_duplicate==1
	replace extrapolated=1 if wave_duplicate==1
	drop wave_duplicate
}
ritest info_exp _b[info_exp], reps(10) seed(840801) cluster(respondentId): reg vaccinated info_exp $vaccination_controls_pap i.vlna extrapolated if vlna>=31 & vlna<=36, vce(cluster respondentId)
drop if extrapolated==1 // now restore to the original dataset
drop extrapolated

ritest info_exp _b[info_exp], reps(10) seed(840801) cluster(respondentId): reg vaccinated info_exp $vaccination_controls_pap i.vlna if vlna>=31 & vlna<=36 & attentive==1, vce(cluster respondentId)
ritest info_exp _b[info_exp], reps(10) seed(840801) cluster(respondentId): reg vaccinated info_exp $vaccination_controls_pap i.vlna if vlna>=31 & vlna<=36 & doctor_vaccine_trust_overest==0, vce(cluster respondentId)
ritest info_exp _b[info_exp], reps(10) seed(840801) cluster(respondentId): reg vaccinated info_exp $vaccination_controls_pap i.vlna if vlna>=31 & vlna<=36 & doctor_vaccine_trust_overest==1, vce(cluster respondentId)
ritest info_exp _b[info_exp], reps(10) seed(840801) cluster(respondentId): reg vaccinated info_exp $vaccination_controls_pap i.vlna if vlna>=31 & vlna<=36 & doctor_vaccine_takeup_overest==0, vce(cluster respondentId)
ritest info_exp _b[info_exp], reps(10) seed(840801) cluster(respondentId): reg vaccinated info_exp $vaccination_controls_pap i.vlna if vlna>=31 & vlna<=36 & doctor_vaccine_takeup_overest==1, vce(cluster respondentId)
ritest info_exp _b[info_exp], reps(10) seed(840801) cluster(respondentId): reg vaccinated info_exp $vaccination_controls_pap i.vlna if vlna>=31 & vlna<=36 & vaccineyesprior==0, vce(cluster respondentId)
ritest info_exp _b[info_exp], reps(10) seed(840801) cluster(respondentId): reg vaccinated info_exp $vaccination_controls_pap i.vlna if vlna>=31 & vlna<=36 & vaccineyesprior==1, vce(cluster respondentId)

*** LASSO
xi: dsregress vaccinated info_exp if vlna>=31 & vlna<=36, controls($vaccination_controls_belief i.vlna) vce(cluster respondentId)
outreg2
xi: dsregress vaccinated info_exp if vlna>=31 & vlna<=36 & allwaves36==1, controls($vaccination_controls_belief i.vlna) vce(cluster respondentId)
outreg2
* IMPUTED DATA
* a) If subsequent wave data missing, duplicate from current wave (and mark as extrapolated from previous wave)
gen extrapolated=0
forval i=25(1)35{
	local j=`i'+1
	expand 2 if vlna==`i' & vlna`j'_part==0, gen(wave_duplicate)
	replace vlna=`j' if wave_duplicate==1
	replace extrapolated=1 if wave_duplicate==1
	drop wave_duplicate
}
xi: dsregress vaccinated info_exp if vlna>=31 & vlna<=36, controls($vaccination_controls_belief i.vlna extrapolated) vce(cluster respondentId)
outreg2
sum vaccinated if vlna>=31 & vlna<=36 & info_exp==0
drop if extrapolated==1 // now restore to the original dataset
drop extrapolated
* b) If previous wave data missing, duplicate from current wave (and mark as extrapolated from next wave)
gen extrapolated=0
forval i=36(-1)25{
	local j=`i'-1
	expand 2 if vlna==`i' & vlna`j'_part==0, gen(wave_duplicate)
	replace vlna=`j' if wave_duplicate==1
	replace extrapolated=1 if wave_duplicate==1
	drop wave_duplicate
}
xi: dsregress vaccinated info_exp if vlna>=31 & vlna<=36, controls($vaccination_controls_belief i.vlna extrapolated) vce(cluster respondentId)
outreg2
sum vaccinated if vlna>=31 & vlna<=36 & info_exp==0
drop if extrapolated==1 // now restore to the original dataset
drop extrapolated

xi: dsregress vaccinated info_exp if vlna>=31 & vlna<=36 & attentive==1, controls($vaccination_controls_belief i.vlna) vce(cluster respondentId)
outreg2
xi: dsregress vaccinated info_exp if vlna>=31 & vlna<=36 & doctor_vaccine_trust_overest==0, controls($vaccination_controls_belief i.vlna) vce(cluster respondentId)
outreg2
xi: dsregress vaccinated info_exp if vlna>=31 & vlna<=36 & doctor_vaccine_trust_overest==1, controls($vaccination_controls_belief i.vlna) vce(cluster respondentId)
outreg2
xi: dsregress vaccinated info_exp if vlna>=31 & vlna<=36 & doctor_vaccine_takeup_overest==0, controls($vaccination_controls_belief i.vlna) vce(cluster respondentId)
outreg2
xi: dsregress vaccinated info_exp if vlna>=31 & vlna<=36 & doctor_vaccine_takeup_overest==1, controls($vaccination_controls_belief i.vlna) vce(cluster respondentId)
outreg2
xi: dsregress vaccinated info_exp if vlna>=31 & vlna<=36 & vaccineyesprior==0, controls($vaccination_controls_belief i.vlna) vce(cluster respondentId)
outreg2
xi: dsregress vaccinated info_exp if vlna>=31 & vlna<=36 & vaccineyesprior==1, controls($vaccination_controls_belief i.vlna) vce(cluster respondentId)
outreg2

sum vaccinated if vlna>=31 & vlna<=36 & info_exp==0
sum vaccinated if vlna>=31 & vlna<=36 & info_exp==0
sum vaccinated if vlna>=31 & vlna<=36 & info_exp==0 & allwaves36==1
* sums for the two imputation methods just above (so that we do not repeat the imputation again)
sum vaccinated if vlna>=31 & vlna<=36 & info_exp==0 & attentive==1
sum vaccinated if vlna>=31 & vlna<=36 & info_exp==0 & doctor_vaccine_trust_overest==0
sum vaccinated if vlna>=31 & vlna<=36 & info_exp==0 & doctor_vaccine_trust_overest==1
sum vaccinated if vlna>=31 & vlna<=36 & info_exp==0 & doctor_vaccine_takeup_overest==0
sum vaccinated if vlna>=31 & vlna<=36 & info_exp==0 & doctor_vaccine_takeup_overest==1
sum vaccinated if vlna>=31 & vlna<=36 & info_exp==0 & vaccineyesprior==0
sum vaccinated if vlna>=31 & vlna<=36 & info_exp==0 & vaccineyesprior==1

*** Formal comparison of coefficients
*** Waves 31-36
* OLS, over/underestimation trust
qui: xi: reg vaccinated info_exp $vaccination_controls_pap i.vlna if vlna>=31 & vlna<=36 & doctor_vaccine_trust_overest==0
qui: est store overest0
qui: xi: reg vaccinated info_exp $vaccination_controls_pap i.vlna if vlna>=31 & vlna<=36 & doctor_vaccine_trust_overest==1
qui: est store overest1
qui: suest overest0 overest1, vce(cluster respondentId)
test [overest0_mean]info_exp=[overest1_mean]info_exp

* OLS, over/underestimation take-up
qui: xi: reg vaccinated info_exp $vaccination_controls_pap i.vlna if vlna>=31 & vlna<=36 & doctor_vaccine_takeup_overest==0
qui: est store overest0
qui: xi: reg vaccinated info_exp $vaccination_controls_pap i.vlna if vlna>=31 & vlna<=36 & doctor_vaccine_takeup_overest==1
qui: est store overest1
qui: suest overest0 overest1, vce(cluster respondentId)
test [overest0_mean]info_exp=[overest1_mean]info_exp

* OLS, prior vaccination intentions
qui: xi: reg vaccinated info_exp $vaccination_controls_pap i.vlna if vlna>=31 & vlna<=36 & vaccineyesprior==0
qui: est store vaccineyesprior0
qui: xi: reg vaccinated info_exp $vaccination_controls_pap i.vlna if vlna>=31 & vlna<=36 & vaccineyesprior==1
qui: est store vaccineyesprior1
qui: suest vaccineyesprior0 vaccineyesprior1, vce(robust)
test [vaccineyesprior0_mean]info_exp=[vaccineyesprior1_mean]info_exp

* LASSO: over/underestimating trust
qui: xi: dsregress vaccinated info_exp if vlna>=31 & vlna<=36 & doctor_vaccine_trust_overest==0, controls($vaccination_controls_belief i.vlna) vce(cluster respondentId)
qui: estimates store vaccinated
lassocoef(vaccinated, for(vaccinated))
// Use selected controls in a regular regression
qui: reg vaccinated info_exp vaccineyesprior vaccinated25 belief_trust25 _Ivlna_31 _Ivlna_36 if vlna>=31 & vlna<=36 & doctor_vaccine_trust_overest==0
qui: est store overest0

qui: xi: dsregress vaccinated info_exp if vlna>=31 & vlna<=36 & doctor_vaccine_trust_overest==1, controls($vaccination_controls_belief i.vlna) vce(cluster respondentId)
qui: estimates store vaccinated
lassocoef(vaccinated, for(vaccinated))
// Use selected controls in a regular regression
qui: reg vaccinated info_exp d_estat3 d_estat5 vaccineyesprior if vlna>=31 & vlna<=36 & doctor_vaccine_trust_overest==1
qui: est store overest1
qui: suest overest0 overest1, vce(cluster respondentId)
test [overest0_mean]info_exp=[overest1_mean]info_exp

* LASSO: over/underestimating take-up
qui: xi: dsregress vaccinated info_exp if vlna>=31 & vlna<=36 & doctor_vaccine_takeup_overest==0, controls($vaccination_controls_belief i.vlna) vce(cluster respondentId)
qui: estimates store vaccinated
lassocoef(vaccinated, for(vaccinated))
// Use selected controls in a regular regression
qui: reg vaccinated info_exp d_age_cat6 vaccineyesprior vaccinated25 belief_trust25 _Ivlna_31 _Ivlna_36 if vlna>=31 & vlna<=36 & doctor_vaccine_takeup_overest==0
qui: est store overest0

qui: xi: dsregress vaccinated info_exp if vlna>=31 & vlna<=36 & doctor_vaccine_takeup_overest==1, controls($vaccination_controls_belief i.vlna) vce(cluster respondentId)
qui: estimates store vaccinated
lassocoef(vaccinated, for(vaccinated))
// Use selected controls in a regular regression
qui: reg vaccinated info_exp d_estat7 if vlna>=31 & vlna<=36 & doctor_vaccine_takeup_overest==1
qui: est store overest1
qui: suest overest0 overest1, vce(cluster respondentId)
test [overest0_mean]info_exp=[overest1_mean]info_exp

* LASSO: prior vaccination intentions
qui: xi: dsregress vaccinated info_exp if vlna>=31 & vlna<=36 & vaccineyesprior==0, controls($vaccination_controls_belief i.vlna) vce(cluster respondentId)
qui: estimates store vaccinated
lassocoef(vaccinated, for(vaccinated))
// Use selected controls in a regular regression
qui: reg vaccinated info_exp belief_trust25 if vlna>=31 & vlna<=36 & vaccineyesprior==0
qui: est store overest0

qui: xi: dsregress vaccinated info_exp if vlna>=31 & vlna<=36 & vaccineyesprior==1, controls($vaccination_controls_belief i.vlna) vce(cluster respondentId)
qui: estimates store vaccinated
lassocoef(vaccinated, for(vaccinated))
// Use selected controls in a regular regression
qui: reg vaccinated info_exp vaccinated25 belief_trust25 if vlna>=31 & vlna<=36 & vaccineyesprior==1
qui: est store overest1
qui: suest overest0 overest1, vce(cluster respondentId)
test [overest0_mean]info_exp=[overest1_mean]info_exp

}

*************************************************************************
** Extended Data Table 6 *************************************************************
*************************************************************************
* Extended Data Table 6. Third party and certificate verification (Main Experiment). 
{
use "$cleandatapath/communicating_consensus_clean.dta", clear
* Third party verification
count if obfuscated==1 & vlna==36 & vlna36_part==1
bysort info_exp: sum obfuscated_part if vlna==36 & vlna36_part==1
tab obfuscated_part info_exp  if vlna==36 & vlna36_part==1, chi2 

bysort info_exp: sum obfuscation_confirmed if vlna==36 & obfuscated_part==1 & vlna36_part==1 & vaccinated==1 // verification for all participating in obfuscation and in wave 36
tab obfuscation_confirmed info_exp if vlna==36 & obfuscated_part==1 & vlna36_part==1 & vaccinated==1, chi2
bysort info_exp: sum obfuscation_confirmed if vlna==36 & obfuscated_part==1 & vlna36_part==1 & vaccinated==0 // verification for all participating in obfuscation and in wave 36
tab obfuscation_confirmed info_exp if vlna==36 & obfuscated_part==1 & vlna36_part==1 & vaccinated==0, chi2

* Certificate verification
count if vlna36_part==1 & vlna==36 & vac_cert_y==1
bysort info_exp: sum vac_cert_y if vlna36_part==1 & vlna==36 & vaccinated==1
tab info_exp vac_cert_y if vlna36_part==1 & vlna==36 & vaccinated==1, chi2
bysort info_ex: sum certificate_confirmed if vac_cert_y==1 & vlna36_part==1 & vlna==36 & vaccinated==1
tab info_ex certificate_confirmed if vac_cert_y==1 & vlna36_part==1 & vlna==36 & vaccinated==1, chi2
}

*************************************************************************
** Table A1 *************************************************************
*************************************************************************
* Supplementary Table 1. Comparison of characteristics of the doctors in the Czech Medical Chamber survey and of all doctors in the Czech Republic (Supplementary Survey).
{
use "$cleandatapath/CLK_vaccines_clean.dta", clear
smpl_restrictions

* Sample means for doctors
gen year_doctor_1_6= years_doctor_1==1 | years_doctor_6==1 // for UZIS, data for seniority only for years 1-4 and 5-10; not matching our categories; thus the merge

gen  town_size_5_6= town_size_5==1 | town_size_6==1 // for UZIS, data for city size only for 20,000-99,999; not matching our categories; thus the merge

sum female age_1 age_2 age_3 age_4 age_5 age_6 sector_state sector_nonstate year_doctor_1_6 years_doctor_11 years_doctor_20 town_size_1 town_size_2 town_size_3 town_size_4  town_size_5_6 town_size_7 district_1 district_2 district_3 district_4 district_5 district_6 district_7 district_8 district_9 district_10 district_11 district_12 district_13 district_14 district_15, sep(100)

foreach v of varlist female age_1 age_2 age_3 age_4 age_5 age_6 sector_state sector_nonstate year_doctor_1_6 years_doctor_11 years_doctor_20 town_size_1 town_size_2 town_size_3 town_size_4 town_size_5_6 town_size_7 district_1 district_2 district_3 district_4 district_5 district_6 district_7 district_8 district_9 district_10 district_11 district_12 district_13 district_14 district_15 { 
	di `"`: var label `v''"' 
}

*** T-tests for difference of sample means from population mean values
* CMC
ttest female=0.598

ttest age_1=0.001
ttest age_2=0.193
ttest age_3=0.187
ttest age_4=0.183
ttest age_5=0.169
ttest age_6=0.267

ttest district_1=0.230
ttest district_2=0.081
ttest district_3=0.053
ttest district_4=0.058
ttest district_5=0.022
ttest district_6=0.056
ttest district_7=0.032
ttest district_8=0.054
ttest district_9=0.037
ttest district_10=0.037
ttest district_11=0.130
ttest district_12=0.065
ttest district_13=0.044
ttest district_14=0.101


* UZIS
ttest female=0.584

ttest age_1=0.001
ttest age_2=0.229
ttest age_3=0.217
ttest age_4=0.199
ttest age_5=0.172
ttest age_6=0.182

ttest sector_state=0.578
ttest sector_nonstate=0.596

ttest year_doctor_1_6=0.254
ttest years_doctor_11=0.190
ttest years_doctor_20=0.516

ttest town_size_1=0.010
ttest town_size_2=0.022
ttest town_size_3=0.047
ttest town_size_4=0.234
ttest town_size_5_6=0.427
ttest town_size_7=0.229

ttest district_1=0.241
ttest district_2=0.100
ttest district_3=0.056
ttest district_4=0.059
ttest district_5=0.025
ttest district_6=0.061
ttest district_7=0.036
ttest district_8=0.055
ttest district_9=0.044
ttest district_10=0.041
ttest district_11=0.130
ttest district_12=0.070
ttest district_13=0.050
ttest district_14=0.114
}

*************************************************************************
** Table A2 *************************************************************
*************************************************************************
* Supplementary Table A2. Share of positive responses of Czech medical doctors to three questions on trust in vaccines, intentions to get vaccinated, and plans to recommend the vaccine to their healthy patients (Supplementary Survey). 
{
use "$cleandatapath/CLK_vaccines_clean.dta", clear
smpl_restrictions

* In main dataset trust dummy coded as 0 / 100 -> divide by 100
replace vaccine_trust_yes=vaccine_trust_yes/100

* Matching survey categories to UZIS data categories (pooling)
gen years_doctor_adj=years_doctor
recode years_doctor_adj (1=1) (2=1) (3=2) (4=3)
gen town_size_adj=town_size 
recode town_size_adj (1=1) (2=2) (3=3) (4=4) (5=5) (6=5) (7=6)

bysort female: sum vaccine_takeup_d vaccine_trust_yes vaccine_recommend_d
bysort age: sum vaccine_takeup_d vaccine_trust_yes vaccine_recommend_d
bysort sector: sum vaccine_takeup_d vaccine_trust_yes vaccine_recommend_d
bysort years_doctor_adj: sum vaccine_takeup_d vaccine_trust_yes vaccine_recommend_d
bysort town_size_adj: sum vaccine_takeup_d vaccine_trust_yes vaccine_recommend_d
bysort district: sum vaccine_takeup_d vaccine_trust_yes vaccine_recommend_d

* Weighted means
* Calculated as UZIS population share / sample share
gen female_weight=.
replace female_weight=0.92 if female==1
replace female_weight=1.14 if female==0

gen age_weight=.
replace age_weight=1.00 if age_1==1
replace age_weight=1.59 if age_2==1
replace age_weight=1.09 if age_3==1
replace age_weight=0.85 if age_4==1
replace age_weight=0.72 if age_5==1
replace age_weight=0.99 if age_6==1

gen sector_weight=.
replace sector_weight=1.62 if sector==1
replace sector_weight=0.93 if sector==2

gen years_doctor_adj_weight=.
replace years_doctor_adj_weight=1.30 if years_doctor_adj==1
replace years_doctor_adj_weight=1.04 if years_doctor_adj==2
replace years_doctor_adj_weight=0.83 if years_doctor_adj==3

gen town_size_adj_weight=.
replace town_size_adj_weight=1.11 if town_size_adj==1
replace town_size_adj_weight=1.05 if town_size_adj==2
replace town_size_adj_weight=1.00 if town_size_adj==3
replace town_size_adj_weight=1.31 if town_size_adj==4
replace town_size_adj_weight=1.35 if town_size_adj==5
replace town_size_adj_weight=0.54 if town_size_adj==6

gen district_weight=.
replace district_weight=1.06 if district==1
replace district_weight=1.15 if district==2
replace district_weight=1.27 if district==3
replace district_weight=1.28 if district==4
replace district_weight=1.00 if district==5
replace district_weight=1.27 if district==6
replace district_weight=0.95 if district==7
replace district_weight=1.06 if district==8
replace district_weight=1.02 if district==9
replace district_weight=0.85 if district==10
replace district_weight=0.94 if district==11
replace district_weight=0.77 if district==12
replace district_weight=1.22 if district==13
replace district_weight=1.56 if district==14

bysort female: sum vaccine_takeup_d vaccine_trust_yes vaccine_recommend_d [aw=female_weight]
bysort age: sum vaccine_takeup_d vaccine_trust_yes vaccine_recommend_d [aw=age_weight]
bysort sector: sum vaccine_takeup_d vaccine_trust_yes vaccine_recommend_d [aw=sector_weight]
bysort years_doctor_adj: sum vaccine_takeup_d vaccine_trust_yes vaccine_recommend_d [aw=years_doctor_adj_weight]
bysort town_size_adj: sum vaccine_takeup_d vaccine_trust_yes vaccine_recommend_d [aw=town_size_adj_weight]
bysort district: sum vaccine_takeup_d vaccine_trust_yes vaccine_recommend_d [aw=district_weight]

}

*************************************************************************
** Table A3 *************************************************************
*************************************************************************
* Supplementary Table A3. Demographic characteristics: summary statistics and randomization check, fixed sample (Main Experiment).
{
use "$cleandatapath/communicating_consensus_clean.dta", clear
* Overall
sum female d_age_cat1 d_age_cat2 d_age_cat3 d_age_cat4 d_age_cat5 d_age_cat6 hsize children children_missing d_region1 d_region2 d_region3 d_region4 d_region5 d_region6 d_region7 d_region8 d_region9 d_region10 d_region11 d_region12 d_region13 d_region14 d_townsize1 d_townsize2 d_townsize3 d_townsize4 d_townsize5 d_townsize6 d_townsize7 d_educ1 d_educ2 d_educ3 d_educ4 d_estat1 d_estat2 d_estat3 d_estat4 d_estat5 d_estat6 d_estat7 d_HHincome1 d_HHincome2 d_HHincome3 d_HHincome4 d_HHincome5 d_HHincome6 d_HHincome7 d_HHincome8 d_HHincome9 d_HHincome10 d_HHincome11  vaccineyesprior vaccineyesprior_missing vaccinated25 nQ300_1_1 nQ301_1_1 if vlna==25 & allwaves36==1, sep(100)

* Comparison of CONTROL and CONSENSUS groups
orth_out female d_age_cat1 d_age_cat2 d_age_cat3 d_age_cat4 d_age_cat5 d_age_cat6 hsize children children_missing d_region1 d_region2 d_region3 d_region4 d_region5 d_region6 d_region7 d_region8 d_region9 d_region10 d_region11 d_region12 d_region13 d_region14 d_townsize1 d_townsize2 d_townsize3 d_townsize4 d_townsize5 d_townsize6 d_townsize7 d_educ1 d_educ2 d_educ3 d_educ4 d_estat1 d_estat2 d_estat3 d_estat4 d_estat5 d_estat6 d_estat7 d_HHincome1 d_HHincome2 d_HHincome3 d_HHincome4 d_HHincome5 d_HHincome6 d_HHincome7 d_HHincome8 d_HHincome9 d_HHincome10 d_HHincome11  vaccineyesprior vaccineyesprior_missing vaccinated25 nQ300_1_1 nQ301_1_1 if vlna==25 & allwaves36==1, by(info_exp) overall pcompare

* Chi2 test for binary variables
foreach x in female d_age_cat1 d_age_cat2 d_age_cat3 d_age_cat4 d_age_cat5 d_age_cat6 children_missing d_region1 d_region2 d_region3 d_region4 d_region5 d_region6 d_region7 d_region8 d_region9 d_region10 d_region11 d_region12 d_region13 d_region14 d_townsize1 d_townsize2 d_townsize3 d_townsize4 d_townsize5 d_townsize6 d_townsize7 d_educ1 d_educ2 d_educ3 d_educ4 d_estat1 d_estat2 d_estat3 d_estat4 d_estat5 d_estat6 d_estat7 d_HHincome1 d_HHincome2 d_HHincome3 d_HHincome4 d_HHincome5 d_HHincome6 d_HHincome7 d_HHincome8 d_HHincome9 d_HHincome10 d_HHincome11  vaccineyesprior vaccineyesprior_missing vaccinated25 {
	di "`x'"
	tab `x' info_exp  if vlna==25 & allwaves36==1, chi2
}

* Ranksum test for continuous variables
foreach x in hsize children nQ300_1_1 nQ301_1_1 {
	di "`x'"
	ranksum `x'  if vlna==25 & allwaves36==1, by(info_exp)
}

count if vlna==25 & allwaves36==1 & !info_exp
count if vlna==25 & allwaves36==1 & info_exp

*** Omnibus randomization test
reg info_exp $vaccination_controls_belief if vlna==25 & allwaves36==1
/*
F(51, 1168)     =      1.09
Prob > F        =    0.3133
*/
}

*************************************************************************
** Table A4 *************************************************************
*************************************************************************
* Supplementary Table 4. Predictors of beliefs about doctors' intentions of getting a Covid-19 vaccine and about doctors' trust in Covid-19 vaccine (Main Experiment).
{
use "$cleandatapath/communicating_consensus_clean.dta", clear
local filechange replace
foreach x in nQ300_1_1 nQ301_1_1 {
	reg `x' $vaccination_controls if vlna==25, r
	outreg2 using "$outputpath/Tables/misperception_predictors.xls" , `filechange' dec(3) se
	local filechange append
}

foreach v of varlist $vaccination_controls { 
	di `"`: var label `v''"' 
}
}

*************************************************************************
** Table A5 *************************************************************
*************************************************************************
* Supplementary Table 5. Effect of the CONSENSUS condition on respondents' Wave1 beliefs about doctors' intentions of getting a Covid-19 vaccine and about doctors' trust in Covid-19 vaccine (Main Experiment).
{
use "$cleandatapath/communicating_consensus_clean.dta", clear
* Panel A: trust beliefs
reg nQ301_1_1 info_exp $vaccination_controls_pap if vlna==26, r
outreg2 using "$outputpath/Tables/regs_beliefs.xls" , replace dec(3) se keep(info_exp)
reg nQ301_1_1 info_exp $vaccination_controls_pap if vlna==26 & allwaves36==1, r
outreg2
reg nQ301_1_1 info_exp $vaccination_controls_pap if vlna==26 & attentive==1, r
outreg2
reg nQ301_1_1 info_exp $vaccination_controls_pap if vlna==26 & doctor_vaccine_trust_overest==0, r
outreg2
reg nQ301_1_1 info_exp $vaccination_controls_pap if vlna==26 & doctor_vaccine_trust_overest==1, r
outreg2
reg nQ301_1_1 info_exp $vaccination_controls_pap if vlna==26 & vaccineyesprior==0, r
outreg2
reg nQ301_1_1 info_exp $vaccination_controls_pap if vlna==26 & vaccineyesprior==1, r
outreg2

xi: dsregress nQ301_1_1 info_exp if vlna==26, controls($vaccination_controls_belief) vce(robust)
outreg2
xi: dsregress nQ301_1_1 info_exp if vlna==26 & allwaves36==1, controls($vaccination_controls_belief) vce(robust)
outreg2
xi: dsregress nQ301_1_1 info_exp if vlna==26 & attentive==1, controls($vaccination_controls_belief) vce(robust)
outreg2
xi: dsregress nQ301_1_1 info_exp if vlna==26 & doctor_vaccine_trust_overest==0, controls($vaccination_controls_belief) vce(robust)
outreg2
xi: dsregress nQ301_1_1 info_exp if vlna==26 & doctor_vaccine_trust_overest==1, controls($vaccination_controls_belief) vce(robust)
outreg2
xi: dsregress nQ301_1_1 info_exp if vlna==26 & vaccineyesprior==0, controls($vaccination_controls_belief) vce(robust)
outreg2
xi: dsregress nQ301_1_1 info_exp if vlna==26 & vaccineyesprior==1, controls($vaccination_controls_belief) vce(robust)
outreg2

sum nQ301_1_1 if vlna==26 & info_exp==0
sum nQ301_1_1 if vlna==26 & info_exp==0 & allwaves36==1
sum nQ301_1_1 if vlna==26 & info_exp==0 & attentive==1
sum nQ301_1_1 if vlna==26 & info_exp==0 & doctor_vaccine_trust_overest==0
sum nQ301_1_1 if vlna==26 & info_exp==0 & doctor_vaccine_trust_overest==1
sum nQ301_1_1 if vlna==26 & info_exp==0 & vaccineyesprior==0
sum nQ301_1_1 if vlna==26 & info_exp==0 & vaccineyesprior==1


* Panel B: vaccination beliefs
reg nQ300_1_1 info_exp $vaccination_controls_pap if vlna==26, r
outreg2
reg nQ300_1_1 info_exp $vaccination_controls_pap if vlna==26 & allwaves36==1, r
outreg2
reg nQ300_1_1 info_exp $vaccination_controls_pap if vlna==26 & attentive==1, r
outreg2
reg nQ300_1_1 info_exp $vaccination_controls_pap if vlna==26 & doctor_vaccine_takeup_overest==0, r
outreg2
reg nQ300_1_1 info_exp $vaccination_controls_pap if vlna==26 & doctor_vaccine_takeup_overest==1, r
outreg2
reg nQ300_1_1 info_exp $vaccination_controls_pap if vlna==26 & vaccineyesprior==0, r
outreg2
reg nQ300_1_1 info_exp $vaccination_controls_pap if vlna==26 & vaccineyesprior==1, r
outreg2

xi: dsregress nQ300_1_1 info_exp if vlna==26, controls($vaccination_controls_belief) vce(robust)
outreg2
xi: dsregress nQ300_1_1 info_exp if vlna==26 & allwaves36==1, controls($vaccination_controls_belief) vce(robust)
outreg2
xi: dsregress nQ300_1_1 info_exp if vlna==26 & attentive==1, controls($vaccination_controls_belief) vce(robust)
outreg2
xi: dsregress nQ300_1_1 info_exp if vlna==26 & doctor_vaccine_trust_overest==0, controls($vaccination_controls_belief) vce(robust)
outreg2
xi: dsregress nQ300_1_1 info_exp if vlna==26 & doctor_vaccine_trust_overest==1, controls($vaccination_controls_belief) vce(robust)
outreg2
xi: dsregress nQ300_1_1 info_exp if vlna==26 & vaccineyesprior==0, controls($vaccination_controls_belief) vce(robust)
outreg2
xi: dsregress nQ300_1_1 info_exp if vlna==26 & vaccineyesprior==1, controls($vaccination_controls_belief) vce(robust)
outreg2

sum nQ300_1_1 if vlna==26 & info_exp==0
sum nQ300_1_1 if vlna==26 & info_exp==0 & allwaves36==1
sum nQ300_1_1 if vlna==26 & info_exp==0 & attentive==1
sum nQ300_1_1 if vlna==26 & info_exp==0 & doctor_vaccine_trust_overest==0
sum nQ300_1_1 if vlna==26 & info_exp==0 & doctor_vaccine_trust_overest==1
sum nQ300_1_1 if vlna==26 & info_exp==0 & vaccineyesprior==0
sum nQ300_1_1 if vlna==26 & info_exp==0 & vaccineyesprior==1

*** Formal comparison of coefficients
*** Trust
* OLS, over/underestimation
qui: reg nQ301_1_1 info_exp $vaccination_controls_pap if vlna==26 & doctor_vaccine_trust_overest==0
qui: est store overest0
qui: reg nQ301_1_1 info_exp $vaccination_controls_pap if vlna==26 & doctor_vaccine_trust_overest==1
qui: est store overest1
qui: suest overest0 overest1, vce(robust)
test [overest0_mean]info_exp=[overest1_mean]info_exp

* OLS, prior vaccination intentions
qui: reg nQ301_1_1 info_exp $vaccination_controls_pap if vlna==26 & vaccineyesprior==0
qui: est store vaccineyesprior0
qui: reg nQ301_1_1 info_exp $vaccination_controls_pap if vlna==26 & vaccineyesprior==1
qui: est store vaccineyesprior1
qui: suest vaccineyesprior0 vaccineyesprior1, vce(robust)
test [vaccineyesprior0_mean]info_exp=[vaccineyesprior1_mean]info_exp

* LASSO: over/underestimation
qui: xi: dsregress nQ301_1_1 info_exp if vlna==26 & doctor_vaccine_trust_overest==0, controls($vaccination_controls_belief) vce(robust)
qui: estimates store vaccinated
lassocoef(vaccinated, for(nQ301_1_1))
// Use selected controls in a regular regression
qui: reg nQ301_1_1 info_exp d_educ4 vaccineyesprior belief_trust25 if vlna==26 & doctor_vaccine_trust_overest==0
qui: est store overest0

qui: xi: dsregress nQ301_1_1 info_exp if vlna==26 & doctor_vaccine_trust_overest==1, controls($vaccination_controls_belief) vce(robust)
qui: estimates store vaccinated
lassocoef(vaccinated, for(nQ301_1_1))
// Use selected controls in a regular regression
qui: reg nQ301_1_1 info_exp d_region10 if vlna==26 & doctor_vaccine_trust_overest==1
qui: est store overest1
qui: suest overest0 overest1, vce(robust)
test [overest0_mean]info_exp=[overest1_mean]info_exp

* LASSO: prior vaccination intentions
qui: xi: dsregress nQ301_1_1 info_exp if vlna==26 & vaccineyesprior==0, controls($vaccination_controls_belief) vce(robust)
qui: estimates store vaccinated
lassocoef(vaccinated, for(nQ301_1_1))
// Use selected controls in a regular regression
qui: reg nQ301_1_1 info_exp d_educ4 belief_takeup25 belief_trust25 if vlna==26 & vaccineyesprior==0
qui: est store vaccineyesprior0

qui: xi: dsregress nQ301_1_1 info_exp if vlna==26 & vaccineyesprior==1, controls($vaccination_controls_belief) vce(robust)
qui: estimates store vaccinated
lassocoef(vaccinated, for(nQ301_1_1))
// Use selected controls in a regular regression
qui: reg nQ301_1_1 info_exp belief_trust25 if vlna==26 & vaccineyesprior==1
qui: est store vaccineyesprior1
qui: suest vaccineyesprior0 vaccineyesprior1, vce(robust)
test [vaccineyesprior0_mean]info_exp=[vaccineyesprior1_mean]info_exp

*** Take-up
* OLS, over/underestimaton
qui: reg nQ300_1_1 info_exp $vaccination_controls_pap if vlna==26 & doctor_vaccine_takeup_overest==0
qui: est store overest0
qui: reg nQ300_1_1 info_exp $vaccination_controls_pap if vlna==26 & doctor_vaccine_takeup_overest==1
qui: est store overest1
qui: suest overest0 overest1, vce(robust)
test [overest0_mean]info_exp=[overest1_mean]info_exp

* OLS, prior vaccination intentions
qui: reg nQ300_1_1 info_exp $vaccination_controls_pap if vlna==26 & vaccineyesprior==0
qui: est store vaccineyesprior0
qui: reg nQ300_1_1 info_exp $vaccination_controls_pap if vlna==26 & vaccineyesprior==1
qui: est store vaccineyesprior1
qui: suest vaccineyesprior0 vaccineyesprior1, vce(robust)
test [vaccineyesprior0_mean]info_exp=[vaccineyesprior1_mean]info_exp

* LASSO: over/underestimation
qui: xi: dsregress nQ300_1_1 info_exp if vlna==26 & doctor_vaccine_takeup_overest==0, controls($vaccination_controls_belief) vce(robust)
qui: estimates store vaccinated
lassocoef(vaccinated, for(nQ300_1_1))
// Use selected controls in a regular regression
qui: reg nQ300_1_1 info_exp d_age_cat2 vaccineyesprior belief_takeup25 belief_trust25 if vlna==26 & doctor_vaccine_takeup_overest==0
qui: est store overest0

qui: xi: dsregress nQ300_1_1 info_exp if vlna==26 & doctor_vaccine_takeup_overest==1, controls($vaccination_controls_belief) vce(robust)
qui: estimates store vaccinated
lassocoef(vaccinated, for(nQ300_1_1))
// Use selected controls in a regular regression
qui: reg nQ300_1_1 info_exp if vlna==26 & doctor_vaccine_takeup_overest==1
qui: est store overest1
qui: suest overest0 overest1, vce(robust)
test [overest0_mean]info_exp=[overest1_mean]info_exp

* LASSO: prior vaccination intentions
qui: xi: dsregress nQ300_1_1 info_exp if vlna==26 & vaccineyesprior==0, controls($vaccination_controls_belief) vce(robust)
qui: estimates store vaccinated
lassocoef(vaccinated, for(nQ300_1_1))
// Use selected controls in a regular regression
qui: reg nQ300_1_1 info_exp belief_takeup25 belief_trust25 if vlna==26 & vaccineyesprior==0
qui: est store vaccineyesprior0

qui: xi: dsregress nQ300_1_1 info_exp if vlna==26 & vaccineyesprior==1, controls($vaccination_controls_belief) vce(robust)
qui: estimates store vaccinated
lassocoef(vaccinated, for(nQ300_1_1))
// Use selected controls in a regular regression
qui: reg nQ300_1_1 info_exp  belief_takeup25 belief_trust25 if vlna==26 & vaccineyesprior==1
qui: est store vaccineyesprior1
qui: suest vaccineyesprior0 vaccineyesprior1, vce(robust)
test [vaccineyesprior0_mean]info_exp=[vaccineyesprior1_mean]info_exp
}

*************************************************************************
** Table A6 *************************************************************
*************************************************************************
* Supplementary Table 6. Effect of the CONSENSUS condition on respondents' vaccination intentions (Main Experiment).
{
use "$cleandatapath/communicating_consensus_clean.dta", clear
* Panel A: Wave 25
reg vaccinate_intention info_exp $vaccination_controls_pap if vlna==25, r
outreg2 using "$outputpath/Tables/regs_intentions2.xls" , replace dec(3) se keep(info_exp)
reg vaccinate_intention info_exp $vaccination_controls_pap if vlna==25 & allwaves36==1, r
outreg2
reg vaccinate_intention info_exp $vaccination_controls_pap if vlna==25 & attentive==1, r
outreg2

xi: dsregress vaccinate_intention info_exp if vlna==25, controls($vaccination_controls_belief) vce(robust)
outreg2
xi: dsregress vaccinate_intention info_exp if vlna==25 & allwaves36==1, controls($vaccination_controls_belief) vce(robust)
outreg2
xi: dsregress vaccinate_intention info_exp if vlna==25 & attentive==1, controls($vaccination_controls_belief) vce(robust)
outreg2


sum vaccinate_intention if vlna==25 & info_exp==0
sum vaccinate_intention if vlna==25 & info_exp==0 & allwaves36==1
sum vaccinate_intention if vlna==25 & info_exp==0 & attentive==1

* Panel B: Wave 26
reg vaccinate_intention info_exp $vaccination_controls_pap if vlna==26, r
outreg2
reg vaccinate_intention info_exp $vaccination_controls_pap if vlna==26 & allwaves36==1, r
outreg2
reg vaccinate_intention info_exp $vaccination_controls_pap if vlna==26 & attentive==1, r
outreg2

xi: dsregress vaccinate_intention info_exp if vlna==26, controls($vaccination_controls_belief) vce(robust)
outreg2
xi: dsregress vaccinate_intention info_exp if vlna==26 & allwaves36==1, controls($vaccination_controls_belief) vce(robust)
outreg2
xi: dsregress vaccinate_intention info_exp if vlna==26 & attentive==1, controls($vaccination_controls_belief) vce(robust)
outreg2

sum vaccinate_intention if vlna==26 & info_exp==0
sum vaccinate_intention if vlna==26 & info_exp==0 & allwaves36==1
sum vaccinate_intention if vlna==26 & info_exp==0 & attentive==1



}

*************************************************************************
** Table A7 *************************************************************
*************************************************************************
* Supplementary Table 7. Effect of the CONSENSUS condition on respondents' vaccination take-up: difference in differences (Main Experiment).
{
use "$cleandatapath/communicating_consensus_clean.dta", clear

gen wave31_36=0
replace wave31_36=1 if vlna>=31 & vlna<=36

xi: reg vaccinated info_exp i.info_exp*wave31_36 if vlna==25 | (vlna>=31 & vlna<=36), vce(cluster respondentId)
outreg2 using "$outputpath/Tables/regs_vaccinated_did.xls" , replace dec(3) se keep(info_exp wave31_36 _IinfXwave3_1)
xi: reg vaccinated info_exp i.info_exp*wave31_36 $vaccination_controls_pap if vlna==25 | (vlna>=31 & vlna<=36), vce(cluster respondentId)
outreg2
xi: dsregress vaccinated info_exp i.info_exp*wave31_36 if vlna==25 | (vlna>=31 & vlna<=36), controls($vaccination_controls_belief) vce(cluster respondentId)
outreg2
xi: reg vaccinated info_exp i.info_exp*wave31_36 if vlna==25 | (vlna>=31 & vlna<=36) & allwaves36==1, vce(cluster respondentId)
outreg2
xi: reg vaccinated info_exp i.info_exp*wave31_36 $vaccination_controls_pap if vlna==25 | (vlna>=31 & vlna<=36) & allwaves36==1, vce(cluster respondentId)
outreg2
xi: dsregress vaccinated info_exp i.info_exp*wave31_36 if vlna==25 | (vlna>=31 & vlna<=36) & allwaves36==1, controls($vaccination_controls_belief) vce(cluster respondentId)
outreg2
}


*************************************************************************
** Table A8 *************************************************************
*************************************************************************
* Supplementary Table 8. Respondent attrition by round (Main Experiment). 
{
use "$cleandatapath/communicating_consensus_clean.dta", clear

*Drop those 50 observations who participated just in the Third-party-verification in wave 36, but not in the main wave 36 of the survey
tab vlna36_part if vlna==36
drop if vlna==36 & vlna36_part==0 

local filechange replace
forvalues x=26(1)36 {
	reg vlna`x'_part info_exp if vlna==25, r
	outreg2 using "$outputpath/Tables/attrition.xls" , `filechange' dec(3) se keep(info_exp)
	local filechange append
}
reg allwaves36 info_exp if vlna==25, r
outreg2

sum vlna26_part if vlna==25 & info_exp==0
sum vlna27_part if vlna==25 & info_exp==0
sum vlna28_part if vlna==25 & info_exp==0
sum vlna29_part if vlna==25 & info_exp==0
sum vlna30_part if vlna==25 & info_exp==0
sum vlna31_part if vlna==25 & info_exp==0
sum vlna32_part if vlna==25 & info_exp==0
sum vlna33_part if vlna==25 & info_exp==0
sum vlna34_part if vlna==25 & info_exp==0
sum vlna35_part if vlna==25 & info_exp==0
sum vlna36_part if vlna==25 & info_exp==0
sum allwaves36 if vlna==25 & info_exp==0

forvalues x=26(1)36 {
	quietly xi: reg vlna`x'_part i.info_exp*female i.info_exp*d_age_cat2 i.info_exp*d_age_cat3 i.info_exp*d_age_cat4 i.info_exp*d_age_cat5 i.info_exp*d_age_cat6 i.info_exp*hsize i.info_exp*children i.info_exp*children_missing i.info_exp*d_region2 i.info_exp*d_region3 i.info_exp*d_region4 i.info_exp*d_region5 i.info_exp*d_region6 i.info_exp*d_region7 i.info_exp*d_region8 i.info_exp*d_region9 i.info_exp*d_region10 i.info_exp*d_region11 i.info_exp*d_region12 i.info_exp*d_region13 i.info_exp*d_region14 i.info_exp*d_townsize2 i.info_exp*d_townsize3 i.info_exp*d_townsize4 i.info_exp*d_townsize5 i.info_exp*d_townsize6 i.info_exp*d_townsize7 i.info_exp*d_educ2 i.info_exp*d_educ3 i.info_exp*d_educ4 i.info_exp*d_estat2 i.info_exp*d_estat3 i.info_exp*d_estat4 i.info_exp*d_estat5 i.info_exp*d_estat6 i.info_exp*d_estat7 i.info_exp*d_HHincome2 i.info_exp*d_HHincome3 i.info_exp*d_HHincome4 i.info_exp*d_HHincome5 i.info_exp*d_HHincome6 i.info_exp*d_HHincome7 i.info_exp*d_HHincome8 i.info_exp*d_HHincome9 i.info_exp*d_HHincome10 i.info_exp*d_HHincome11 i.info_exp*vaccineyesprior i.info_exp*vaccineyesprior_missing if vlna==25, r
	* Omnibus test for a joint effect of interaction terms
	test _Iinfo_exp_1 _IinfXfemal_1 _IinfXd_age_1 _IinfXd_agea1 _IinfXd_ageb1 _IinfXd_agec1 _IinfXd_aged1 _IinfXhsize_1 _IinfXchild_1 _IinfXchilda1 _IinfXd_reg_1 _IinfXd_rega1 _IinfXd_regb1 _IinfXd_regc1 _IinfXd_regd1 _IinfXd_rege1 _IinfXd_regf1 _IinfXd_regg1 _IinfXd_regh1 _IinfXd_regi1 _IinfXd_regj1 _IinfXd_regk1 _IinfXd_regl1 _IinfXd_tow_1 _IinfXd_towa1 _IinfXd_towb1 _IinfXd_towc1 _IinfXd_towd1 _IinfXd_towe1 _IinfXd_edu_1 _IinfXd_edua1 _IinfXd_edub1 _IinfXd_est_1 _IinfXd_esta1 _IinfXd_estb1 _IinfXd_estc1 _IinfXd_estd1 _IinfXd_este1 _IinfXd_HHi_1 _IinfXd_HHia1 _IinfXd_HHib1 _IinfXd_HHic1 _IinfXd_HHid1 _IinfXd_HHie1 _IinfXd_HHif1 _IinfXd_HHig1 _IinfXd_HHih1 _IinfXd_HHii1 _IinfXvacci_1 _IinfXvaccia1
}

* Any treatment-specific predictors of being an always-taker?
	quietly xi: reg allwaves36 i.info_exp*female i.info_exp*d_age_cat2 i.info_exp*d_age_cat3 i.info_exp*d_age_cat4 i.info_exp*d_age_cat5 i.info_exp*d_age_cat6 i.info_exp*hsize i.info_exp*children i.info_exp*children_missing i.info_exp*d_region2 i.info_exp*d_region3 i.info_exp*d_region4 i.info_exp*d_region5 i.info_exp*d_region6 i.info_exp*d_region7 i.info_exp*d_region8 i.info_exp*d_region9 i.info_exp*d_region10 i.info_exp*d_region11 i.info_exp*d_region12 i.info_exp*d_region13 i.info_exp*d_region14 i.info_exp*d_townsize2 i.info_exp*d_townsize3 i.info_exp*d_townsize4 i.info_exp*d_townsize5 i.info_exp*d_townsize6 i.info_exp*d_townsize7 i.info_exp*d_educ2 i.info_exp*d_educ3 i.info_exp*d_educ4 i.info_exp*d_estat2 i.info_exp*d_estat3 i.info_exp*d_estat4 i.info_exp*d_estat5 i.info_exp*d_estat6 i.info_exp*d_estat7 i.info_exp*d_HHincome2 i.info_exp*d_HHincome3 i.info_exp*d_HHincome4 i.info_exp*d_HHincome5 i.info_exp*d_HHincome6 i.info_exp*d_HHincome7 i.info_exp*d_HHincome8 i.info_exp*d_HHincome9 i.info_exp*d_HHincome10 i.info_exp*d_HHincome11 i.info_exp*vaccineyesprior i.info_exp*vaccineyesprior_missing if vlna==25, r
test _Iinfo_exp_1 _IinfXfemal_1 _IinfXd_age_1 _IinfXd_agea1 _IinfXd_ageb1 _IinfXd_agec1 _IinfXd_aged1 _IinfXhsize_1 _IinfXchild_1 _IinfXchilda1 _IinfXd_reg_1 _IinfXd_rega1 _IinfXd_regb1 _IinfXd_regc1 _IinfXd_regd1 _IinfXd_rege1 _IinfXd_regf1 _IinfXd_regg1 _IinfXd_regh1 _IinfXd_regi1 _IinfXd_regj1 _IinfXd_regk1 _IinfXd_regl1 _IinfXd_tow_1 _IinfXd_towa1 _IinfXd_towb1 _IinfXd_towc1 _IinfXd_towd1 _IinfXd_towe1 _IinfXd_edu_1 _IinfXd_edua1 _IinfXd_edub1 _IinfXd_est_1 _IinfXd_esta1 _IinfXd_estb1 _IinfXd_estc1 _IinfXd_estd1 _IinfXd_este1 _IinfXd_HHi_1 _IinfXd_HHia1 _IinfXd_HHib1 _IinfXd_HHic1 _IinfXd_HHid1 _IinfXd_HHie1 _IinfXd_HHif1 _IinfXd_HHig1 _IinfXd_HHih1 _IinfXd_HHii1 _IinfXvacci_1 _IinfXvaccia1
}


*************************************************************************
** Table A9 *************************************************************
*************************************************************************
* Supplementary Table 9. Third party and certificate verification: ordered and multinomial logit (Main Experiment). 
{
use "$cleandatapath/communicating_consensus_clean.dta", clear

*** Third party verification
gen vaccinated_obf_levels=0
replace vaccinated_obf_levels=1 if vaccinated==1 & obfuscation_confirmed==0
replace vaccinated_obf_levels=2 if vaccinated==1 & obfuscation_confirmed==1
replace vaccinated_obf_levels=. if vaccinated==.

*** Certificate verification
gen vaccinated_cert_levels=0
replace vaccinated_cert_levels=1 if vaccinated==1 & vaccinated_certcode==0
replace vaccinated_cert_levels=2 if vaccinated==1 & vaccinated_certcode==1
replace vaccinated_cert_levels=. if vaccinated==.

*** Third party OR certificate verification
gen vaccinated_cert_obf_levels=0
replace vaccinated_cert_obf_levels=1 if vaccinated==1 & (certificate_confirmed==0 & obfuscation_confirmed==0)
replace vaccinated_cert_obf_levels=2 if vaccinated==1 & (certificate_confirmed==1 | obfuscation_confirmed==1)
replace vaccinated_cert_obf_levels=. if vaccinated==.


*****Ordered logit

* Third party verification (Column 1)
qui: xi: ologit vaccinated_obf_levels info_exp i.vlna $vaccination_controls_pap if vlna>=31 & vlna<=36, vce(cluster respondentId)
est sto m
forval i = 0/2 {
	est res m
	qui: margins, dydx(info_exp) pr(out(`i')) post
	est sto m`i'
}
estout m2 m1 m0, cells(b(fmt(3)) se (par fmt(3)) p(par([ ]) fmt(3)))

* Certificate verification (Column 2)
qui: xi: ologit vaccinated_cert_levels info_exp i.vlna $vaccination_controls_pap if vlna>=31 & vlna<=36, vce(cluster respondentId)
est sto m
forval i = 0/2 {
	est res m
	qui: margins, dydx(info_exp) pr(out(`i')) post
	est sto m`i'
}
estout m2 m1 m0, cells(b(fmt(3)) se (par fmt(3)) p(par([ ]) fmt(3)))

* Third party OR certificate verification (Column 3)
qui: xi: ologit vaccinated_cert_obf_levels info_exp i.vlna $vaccination_controls_pap if vlna>=31 & vlna<=36, vce(cluster respondentId)
est sto m
forval i = 0/2 {
	est res m
	qui: margins, dydx(info_exp) pr(out(`i')) post
	est sto m`i'
}
estout m2 m1 m0, cells(b(fmt(3)) se (par fmt(3)) p(par([ ]) fmt(3)))

*****Multinomial logit

* Third party verification (Column 4)
qui: xi: mlogit vaccinated_obf_levels info_exp i.vlna $vaccination_controls_pap if vlna>=31 & vlna<=36, vce(cluster respondentId) base(1)
est sto m
forval i = 0/2 {
	est res m
	qui: margins, dydx(info_exp) pr(out(`i')) post
	est sto m`i'
}
estout m2 m1 m0, cells(b(fmt(3)) se (par fmt(3)) p(par([ ]) fmt(3)))


* Certificate verification (Column 5)
qui: xi: mlogit vaccinated_cert_levels info_exp i.vlna $vaccination_controls_pap if vlna>=31 & vlna<=36, vce(cluster respondentId) base(1)
est sto m
forval i = 0/2 {
	est res m
	qui: margins, dydx(info_exp) pr(out(`i')) post
	est sto m`i'
}
estout m2 m1 m0, cells(b(fmt(3)) se (par fmt(3)) p(par([ ]) fmt(3)))

* Third party OR certificate verification (Column 6)
qui: xi: mlogit vaccinated_cert_obf_levels info_exp i.vlna $vaccination_controls_pap if vlna>=31 & vlna<=36, vce(cluster respondentId) base(1)
est sto m
forval i = 0/2 {
	est res m
	qui: margins, dydx(info_exp) pr(out(`i')) post
	est sto m`i'
}
estout m2 m1 m0, cells(b(fmt(3)) se (par fmt(3)) p(par([ ]) fmt(3)))
}

*************************************************************************
** Table A10 ************************************************************
*************************************************************************
* Supplementary Table 10. Cox proportional hazard model of vaccine take-up by CONSENSUS condition (Main Experiment)
{
use "$cleandatapath/communicating_consensus_clean.dta", clear

*Drop those 50 observations who participated just in the Third-party-verification in wave 36, but not in the main wave 36 of the survey
tab vlna36_part if vlna==36
drop if vlna==36 & vlna36_part==0 


* Following https://stats.idre.ucla.edu/stata/seminars/stata-survival/
stset vlna, id(respondentId) failure(vaccinated)
* Cumulative hazard curve
sts graph, na by(info_exp)
* From the graph we see that the survival function for each group of treat are not perfectly parallel
* For the categorical variables we will use the log-rank test of equality across strata which is a non-parametric test.  
sts test info_exp if vlna>25, logrank

stcox info_exp $vaccination_controls_pap if vlna>25, nohr vce(robust)
outreg2 using "$outputpath/Tables/regs_survival.xls" , replace dec(3) se keep(info_exp)
stcox info_exp if vlna>25, nohr vce(robust)
outreg2
stcox info_exp $vaccination_controls_pap if vlna>25 & allwaves36==1, nohr vce(robust)
outreg2
stcox info_exp $vaccination_controls_pap if vlna>25 & attentive==1, nohr vce(robust)
outreg2
stcox info_exp $vaccination_controls_pap if vlna>25 & doctor_vaccine_trust_overest==0, nohr vce(robust)
outreg2
stcox info_exp $vaccination_controls_pap if vlna>25 & doctor_vaccine_trust_overest==1, nohr vce(robust)
outreg2
stcox info_exp $vaccination_controls_pap if vlna>25 & doctor_vaccine_takeup_overest==0, nohr vce(robust)
outreg2
stcox info_exp $vaccination_controls_pap if vlna>25 & doctor_vaccine_takeup_overest==1, nohr vce(robust)
outreg2
stcox info_exp $vaccination_controls_pap if vlna>25 & vaccineyesprior==0, nohr vce(robust)
outreg2
stcox info_exp $vaccination_controls_pap if vlna>25 & vaccineyesprior==1, nohr vce(robust)
outreg2
}

*************************************************************************
** Table A11 ************************************************************
*************************************************************************
* Supplementary Table 11. Effect of the CONSENSUS condition on respondents' vaccination take-up: heterogeneity (Main Experiment).
{
use "$cleandatapath/communicating_consensus_clean.dta", clear

*** Full sample
{
xi: reg vaccinated info_exp i.vlna $vaccination_controls_pap if vlna>=31 & vlna<=36 & (d_age_cat1==1 | d_age_cat2==1), vce(cluster respondentId)
outreg2 using "$outputpath/Tables/vaccinated_heterogeneity.xls" , replace dec(3) se keep(info_exp)
* 35-54
xi: reg vaccinated info_exp i.vlna $vaccination_controls_pap if vlna>=31 & vlna<=36 & (d_age_cat3==1 | d_age_cat4==1), vce(cluster respondentId)
outreg2
* 55+
xi: reg vaccinated info_exp i.vlna $vaccination_controls_pap if vlna>=31 & vlna<=36 & (d_age_cat5==1 | d_age_cat6==1)==1, vce(cluster respondentId)
outreg2

* Female
xi: reg vaccinated info_exp i.vlna $vaccination_controls_pap if vlna>=31 & vlna<=36 & female==1, vce(cluster respondentId)
outreg2
* Male
xi: reg vaccinated info_exp i.vlna $vaccination_controls_pap if vlna>=31 & vlna<=36 & female==0, vce(cluster respondentId)
outreg2

* Income below median
xi: reg vaccinated info_exp i.vlna $vaccination_controls_pap if vlna>=31 & vlna<=36 & (HHincome<6 & HHincome!=99), vce(cluster respondentId)
outreg2
* Income above median
xi: reg vaccinated info_exp i.vlna $vaccination_controls_pap if vlna>=31 & vlna<=36 & (HHincome>=6 & HHincome!=99), vce(cluster respondentId)
outreg2

* Town size less than 100,000
xi: reg vaccinated info_exp i.vlna $vaccination_controls_pap if vlna>=31 & vlna<=36 & d_townsize7==0, vce(cluster respondentId)
outreg2
* Town size 100,000 and more
xi: reg vaccinated info_exp i.vlna $vaccination_controls_pap if vlna>=31 & vlna<=36 & d_townsize7==1, vce(cluster respondentId)
outreg2

* at most lower secondary education
xi: reg vaccinated info_exp i.vlna $vaccination_controls_pap if vlna>=31 & vlna<=36 & (d_educ1==1 | d_educ2==1), vce(cluster respondentId)
outreg2
* secondary school completed
xi: reg vaccinated info_exp i.vlna $vaccination_controls_pap if vlna>=31 & vlna<=36 & d_educ3==1, vce(cluster respondentId)
outreg2
* university
xi: reg vaccinated info_exp i.vlna $vaccination_controls_pap if vlna>=31 & vlna<=36 & d_educ4==1, vce(cluster respondentId)
outreg2

* No demand for information about vaccines
xi: reg vaccinated info_exp i.vlna $vaccination_controls_pap if vlna>=31 & vlna<=36 & info_demand==0, vce(cluster respondentId)
outreg2
* Demand for information about vaccines
xi: reg vaccinated info_exp i.vlna $vaccination_controls_pap if vlna>=31 & vlna<=36 & info_demand==1, vce(cluster respondentId)
outreg2
}

*** Fixed sample
{
xi: reg vaccinated info_exp i.vlna $vaccination_controls_pap if vlna>=31 & vlna<=36 & allwaves36==1 & (d_age_cat1==1 | d_age_cat2==1), vce(cluster respondentId)
outreg2
* 35-54
xi: reg vaccinated info_exp i.vlna $vaccination_controls_pap if vlna>=31 & vlna<=36 & allwaves36==1 & (d_age_cat3==1 | d_age_cat4==1), vce(cluster respondentId)
outreg2
* 55+
xi: reg vaccinated info_exp i.vlna $vaccination_controls_pap if vlna>=31 & vlna<=36 & allwaves36==1 & (d_age_cat5==1 | d_age_cat6==1)==1, vce(cluster respondentId)
outreg2

* Female
xi: reg vaccinated info_exp i.vlna $vaccination_controls_pap if vlna>=31 & vlna<=36 & allwaves36==1 & female==1, vce(cluster respondentId)
outreg2
* Male
xi: reg vaccinated info_exp i.vlna $vaccination_controls_pap if vlna>=31 & vlna<=36 & allwaves36==1 & female==0, vce(cluster respondentId)
outreg2

* Income below median
xi: reg vaccinated info_exp i.vlna $vaccination_controls_pap if vlna>=31 & vlna<=36 & allwaves36==1 & (HHincome<6 & HHincome!=99), vce(cluster respondentId)
outreg2
* Income above median
xi: reg vaccinated info_exp i.vlna $vaccination_controls_pap if vlna>=31 & vlna<=36 & allwaves36==1 & (HHincome>=6 & HHincome!=99), vce(cluster respondentId)
outreg2

* Town size less than 100,000
xi: reg vaccinated info_exp i.vlna $vaccination_controls_pap if vlna>=31 & vlna<=36 & allwaves36==1 & d_townsize7==0, vce(cluster respondentId)
outreg2
* Town size 100,000 and more
xi: reg vaccinated info_exp i.vlna $vaccination_controls_pap if vlna>=31 & vlna<=36 & allwaves36==1 & d_townsize7==1, vce(cluster respondentId)
outreg2

* at most lower secondary education
xi: reg vaccinated info_exp i.vlna $vaccination_controls_pap if vlna>=31 & vlna<=36 & allwaves36==1 & (d_educ1==1 | d_educ2==1), vce(cluster respondentId)
outreg2
* secondary school completed
xi: reg vaccinated info_exp i.vlna $vaccination_controls_pap if vlna>=31 & vlna<=36 & allwaves36==1 & d_educ3==1, vce(cluster respondentId)
outreg2
* university
xi: reg vaccinated info_exp i.vlna $vaccination_controls_pap if vlna>=31 & vlna<=36 & allwaves36==1 & d_educ4==1, vce(cluster respondentId)
outreg2

* No demand for information about vaccines
xi: reg vaccinated info_exp i.vlna $vaccination_controls_pap if vlna>=31 & vlna<=36 & allwaves36==1 & info_demand==0, vce(cluster respondentId)
outreg2
* Demand for information about vaccines
xi: reg vaccinated info_exp i.vlna $vaccination_controls_pap if vlna>=31 & vlna<=36 & allwaves36==1 & info_demand==1, vce(cluster respondentId)
outreg2
}

* Control means
{
*** Full sample
sum vaccinated if info_exp==0 & vlna>=31 & vlna<=36 & (d_age_cat1==1 | d_age_cat2==1)
* 35-54
sum vaccinated if info_exp==0 & vlna>=31 & vlna<=36 & (d_age_cat3==1 | d_age_cat4==1)
* 55+
sum vaccinated if info_exp==0 & vlna>=31 & vlna<=36 & (d_age_cat5==1 | d_age_cat6==1)==1

* Female
sum vaccinated if info_exp==0 & vlna>=31 & vlna<=36 & female==1
* Male
sum vaccinated if info_exp==0 & vlna>=31 & vlna<=36 & female==0

* Income below median
sum vaccinated if info_exp==0 & vlna>=31 & vlna<=36 & (HHincome<6 & HHincome!=99)
* Income above median
sum vaccinated if info_exp==0 & vlna>=31 & vlna<=36 & (HHincome>=6 & HHincome!=99)

* Town size less than 100,000
sum vaccinated if info_exp==0 & vlna>=31 & vlna<=36 & d_townsize7==0
* Town size 100,000 and more
sum vaccinated if info_exp==0 & vlna>=31 & vlna<=36 & d_townsize7==1

* at most lower secondary education
sum vaccinated if info_exp==0 & vlna>=31 & vlna<=36 & (d_educ1==1 | d_educ2==1)
* secondary school completed
sum vaccinated if info_exp==0 & vlna>=31 & vlna<=36 & d_educ3==1
* university
sum vaccinated if info_exp==0 & vlna>=31 & vlna<=36 & d_educ4==1

* No demand for information about vaccines
sum vaccinated if info_exp==0 & vlna>=31 & vlna<=36 & info_demand==0
* Demand for information about vaccines
sum vaccinated if info_exp==0 & vlna>=31 & vlna<=36 & info_demand==1

*** Fixed sample
sum vaccinated if info_exp==0 & vlna>=31 & vlna<=36 & allwaves36==1 & (d_age_cat1==1 | d_age_cat2==1)
* 35-54
sum vaccinated if info_exp==0 & vlna>=31 & vlna<=36 & allwaves36==1 & (d_age_cat3==1 | d_age_cat4==1)
* 55+
sum vaccinated if info_exp==0 & vlna>=31 & vlna<=36 & allwaves36==1 & (d_age_cat5==1 | d_age_cat6==1)==1

* Female
sum vaccinated if info_exp==0 & vlna>=31 & vlna<=36 & allwaves36==1 & female==1
* Male
sum vaccinated if info_exp==0 & vlna>=31 & vlna<=36 & allwaves36==1 & female==0

* Income below median
sum vaccinated if info_exp==0 & vlna>=31 & vlna<=36 & allwaves36==1 & (HHincome<6 & HHincome!=99)
* Income above median
sum vaccinated if info_exp==0 & vlna>=31 & vlna<=36 & allwaves36==1 & (HHincome>=6 & HHincome!=99)

* Town size less than 100,000
sum vaccinated if info_exp==0 & vlna>=31 & vlna<=36 & allwaves36==1 & d_townsize7==0
* Town size 100,000 and more
sum vaccinated if info_exp==0 & vlna>=31 & vlna<=36 & allwaves36==1 & d_townsize7==1

* at most lower secondary education
sum vaccinated if info_exp==0 & vlna>=31 & vlna<=36 & allwaves36==1 & (d_educ1==1 | d_educ2==1)
* secondary school completed
sum vaccinated if info_exp==0 & vlna>=31 & vlna<=36 & allwaves36==1 & d_educ3==1
* university
sum vaccinated if info_exp==0 & vlna>=31 & vlna<=36 & allwaves36==1 & d_educ4==1

* No demand for information about vaccines
sum vaccinated if info_exp==0 & vlna>=31 & vlna<=36 & allwaves36==1 & info_demand==0
* Demand for information about vaccines
sum vaccinated if info_exp==0 & vlna>=31 & vlna<=36 & allwaves36==1 & info_demand==1
}

*** Comparisons
{
*** Full sample
{
qui: xi: reg vaccinated info_exp i.vlna $vaccination_controls_pap if vlna>=31 & vlna<=36 & (d_age_cat1==1 | d_age_cat2==1)
qui: est store regage1
* 35-54
qui: xi: reg vaccinated info_exp i.vlna $vaccination_controls_pap if vlna>=31 & vlna<=36 & (d_age_cat3==1 | d_age_cat4==1)
qui: est store regage2
* 55+
qui: xi: reg vaccinated info_exp i.vlna $vaccination_controls_pap if vlna>=31 & vlna<=36 & (d_age_cat5==1 | d_age_cat6==1)==1
qui: est store regage3

* Female
qui: xi: reg vaccinated info_exp i.vlna $vaccination_controls_pap if vlna>=31 & vlna<=36 & female==1
qui: est store regfemale
* Male
qui: xi: reg vaccinated info_exp i.vlna $vaccination_controls_pap if vlna>=31 & vlna<=36 & female==0
qui: est store regmale

* Income below median
qui: xi: reg vaccinated info_exp i.vlna $vaccination_controls_pap if vlna>=31 & vlna<=36 & (HHincome<6 & HHincome!=99)
qui: est store regincbelow
* Income above median
qui: xi: reg vaccinated info_exp i.vlna $vaccination_controls_pap if vlna>=31 & vlna<=36 & (HHincome>=6 & HHincome!=99)
qui: est store regincabove

* Town size less than 100,000
qui: xi: reg vaccinated info_exp i.vlna $vaccination_controls_pap if vlna>=31 & vlna<=36 & d_townsize7==0
qui: est store regtownless
* Town size 100,000 and more
qui: xi: reg vaccinated info_exp i.vlna $vaccination_controls_pap if vlna>=31 & vlna<=36 & d_townsize7==1
qui: est store regtownmore

* at most lower secondary education
qui: xi: reg vaccinated info_exp i.vlna $vaccination_controls_pap if vlna>=31 & vlna<=36 & (d_educ1==1 | d_educ2==1)
qui: est store regeduclow
* secondary school completed
qui: xi: reg vaccinated info_exp i.vlna $vaccination_controls_pap if vlna>=31 & vlna<=36 & d_educ3==1
qui: est store regeducsec
* university
qui: xi: reg vaccinated info_exp i.vlna $vaccination_controls_pap if vlna>=31 & vlna<=36 & d_educ4==1
qui: est store regeducuni

* No demand for information about vaccines
qui: xi: reg vaccinated info_exp i.vlna $vaccination_controls_pap if vlna>=31 & vlna<=36 & info_demand==0
qui: est store regnodem
* Demand for information about vaccines
qui: xi: reg vaccinated info_exp i.vlna $vaccination_controls_pap if vlna>=31 & vlna<=36 & info_demand==1
qui: est store regdem
}

*** Fixed sample
{
qui: xi: reg vaccinated info_exp i.vlna $vaccination_controls_pap if vlna>=31 & vlna<=36 & allwaves36==1 & (d_age_cat1==1 | d_age_cat2==1)
qui: est store regage1fix
* 35-54
qui: xi: reg vaccinated info_exp i.vlna $vaccination_controls_pap if vlna>=31 & vlna<=36 & allwaves36==1 & (d_age_cat3==1 | d_age_cat4==1)
qui: est store regage2fix
* 55+
qui: xi: reg vaccinated info_exp i.vlna $vaccination_controls_pap if vlna>=31 & vlna<=36 & allwaves36==1 & (d_age_cat5==1 | d_age_cat6==1)==1
qui: est store regage3fix

* Female
qui: xi: reg vaccinated info_exp i.vlna $vaccination_controls_pap if vlna>=31 & vlna<=36 & allwaves36==1 & female==1
qui: est store regfemalefix
* Male
qui: xi: reg vaccinated info_exp i.vlna $vaccination_controls_pap if vlna>=31 & vlna<=36 & allwaves36==1 & female==0
qui: est store regmalefix

* Income below median
qui: xi: reg vaccinated info_exp i.vlna $vaccination_controls_pap if vlna>=31 & vlna<=36 & allwaves36==1 & (HHincome<6 & HHincome!=99)
qui: est store regincbelowfix
* Income above median
qui: xi: reg vaccinated info_exp i.vlna $vaccination_controls_pap if vlna>=31 & vlna<=36 & allwaves36==1 & (HHincome>=6 & HHincome!=99)
qui: est store regincabovefix

* Town size less than 100,000
qui: xi: reg vaccinated info_exp i.vlna $vaccination_controls_pap if vlna>=31 & vlna<=36 & allwaves36==1 & d_townsize7==0
qui: est store regtownlessfix
* Town size 100,000 and more
qui: xi: reg vaccinated info_exp i.vlna $vaccination_controls_pap if vlna>=31 & vlna<=36 & allwaves36==1 & d_townsize7==1
qui: est store regtownmorefix

* at most lower secondary education
qui: xi: reg vaccinated info_exp i.vlna $vaccination_controls_pap if vlna>=31 & vlna<=36 & allwaves36==1 & (d_educ1==1 | d_educ2==1)
qui: est store regeduclowfix
* secondary school completed
qui: xi: reg vaccinated info_exp i.vlna $vaccination_controls_pap if vlna>=31 & vlna<=36 & allwaves36==1 & d_educ3==1
qui: est store regeducsecfix
* university
qui: xi: reg vaccinated info_exp i.vlna $vaccination_controls_pap if vlna>=31 & vlna<=36 & allwaves36==1 & d_educ4==1
qui: est store regeducunifix

* No demand for information about vaccines
qui: xi: reg vaccinated info_exp i.vlna $vaccination_controls_pap if vlna>=31 & vlna<=36 & allwaves36==1 & info_demand==0
qui: est store regnodemfix
* Demand for information about vaccines
qui: xi: reg vaccinated info_exp i.vlna $vaccination_controls_pap if vlna>=31 & vlna<=36 & allwaves36==1 & info_demand==1
qui: est store regdemfix
}

*** Full sample
* Age 1-2
qui: suest regage1 regage2, vce(cluster respondentId)
test [regage1_mean]info_exp=[regage2_mean]info_exp
* Age 2-3
qui: suest regage2 regage3, vce(cluster respondentId)
test [regage2_mean]info_exp=[regage3_mean]info_exp
* Age 1-3
qui: suest regage1 regage3, vce(cluster respondentId)
test [regage1_mean]info_exp=[regage3_mean]info_exp
* Male-Female
qui: suest regmale regfemale, vce(cluster respondentId)
test [regmale_mean]info_exp=[regfemale_mean]info_exp
* Income below-above
qui: suest regincbelow regincabove, vce(cluster respondentId)
test [regincbelow_mean]info_exp=[regincabove_mean]info_exp
* Town size less-more
qui: suest regtownless regtownmore, vce(cluster respondentId)
test [regtownless_mean]info_exp=[regtownmore_mean]info_exp
* Edu 1-2
qui: suest regeduclow regeducsec, vce(cluster respondentId)
test [regeduclow_mean]info_exp=[regeducsec_mean]info_exp
* Edu 2-3
qui: suest regeducsec regeducuni, vce(cluster respondentId)
test [regeducsec_mean]info_exp=[regeducuni_mean]info_exp
* Edu 1-3
qui: suest regeduclow regeducuni, vce(cluster respondentId)
test [regeduclow_mean]info_exp=[regeducuni_mean]info_exp
* Demand (no-yes)
qui: suest regnodem regdem, vce(cluster respondentId)
test [regnodem_mean]info_exp=[regdem_mean]info_exp

*** Fixed sample
* Age 1-2
qui: suest regage1fix regage2fix, vce(cluster respondentId)
test [regage1fix_mean]info_exp=[regage2fix_mean]info_exp
* Age 2-3
qui: suest regage2fix regage3fix, vce(cluster respondentId)
test [regage2fix_mean]info_exp=[regage3fix_mean]info_exp
* Age 1-3
qui: suest regage1fix regage3fix, vce(cluster respondentId)
test [regage1fix_mean]info_exp=[regage3fix_mean]info_exp
* Male-Female
qui: suest regmalefix regfemalefix, vce(cluster respondentId)
test [regmalefix_mean]info_exp=[regfemalefix_mean]info_exp
* Income below-above
qui: suest regincbelowfix regincabovefix, vce(cluster respondentId)
test [regincbelowfix_mean]info_exp=[regincabovefix_mean]info_exp
* Town size less-more
qui: suest regtownlessfix regtownmorefix, vce(cluster respondentId)
test [regtownlessfix_mean]info_exp=[regtownmorefix_mean]info_exp
* Edu 1-2
qui: suest regeduclowfix regeducsecfix, vce(cluster respondentId)
test [regeduclowfix_mean]info_exp=[regeducsecfix_mean]info_exp
* Edu 2-3
qui: suest regeducsecfix regeducunifix, vce(cluster respondentId)
test [regeducsecfix_mean]info_exp=[regeducunifix_mean]info_exp
* Edu 1-3
qui: suest regeduclowfix regeducunifix, vce(cluster respondentId)
test [regeduclowfix_mean]info_exp=[regeducunifix_mean]info_exp
* Demand (no-yes)
qui: suest regnodemfix regdemfix, vce(cluster respondentId)
test [regnodemfix_mean]info_exp=[regdemfix_mean]info_exp
}
}


}

log close
